Compare commits

...

265 Commits

Author SHA1 Message Date
luca.mazzoleni 624a188481 Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-08-26 12:44:09 +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 d3c2787f81 Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-08-23 08:54:45 +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 93b4adfdec Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-08-12 09:58:54 +02:00
luca.mazzoleni d5140acc91 BugFix:
correzioni minori
2022-08-12 09:58:33 +02:00
luca.mazzoleni 1d672af81e Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-08-12 09:34:38 +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 8a79a7838e Merge branch 'BugFix/ScarfOneFaceReduceToCut' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-08-09 10:28:00 +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 172fc5180a Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-07-29 10:07:59 +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 6064a19a2c Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-07-25 15:34:53 +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 5cc85a8735 Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-07-25 11:17:30 +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 7af9a9affb BugFix/ProcessLapJointThreeFacesLOpenPocket:
modificata ProcessLapJoint -> SetOpenSide ma attendere il check della lavorazione C++
2022-07-19 15:10:25 +02:00
luca.mazzoleni e26a42dfd9 Merge branch 'develop' into BugFix/ProcessLapJointThreeFacesLOpenPocket 2022-07-19 11:09:12 +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 10167 additions and 2769 deletions
+6
View File
@@ -16,3 +16,9 @@
/bin /bin
/obj /obj
/.vs /.vs
/32/*.lua
/32/LuaLibs/*.lua
/32/Images/*.png
/64/*.lua
/64/LuaLibs/*.lua
/64/Images/*.png
+119
View File
@@ -0,0 +1,119 @@
variables:
VERS_MAIN: '1.0'
APP_NAME: 'Beam'
NEW_REL: ''
NET_SHARE_R: '\\10.74.82.201\Artifacts\EGT_SRV\EgtTech'
NET_USER: '10.74.82.50\Server'
NET_SHARE_Z: '\\10.74.82.200\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 -- Gestione calcolo batch disposizione e lavorazioni per Travi
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
-- 2019/07/16 Aggiunta gestione modalità oltre 10 per impostazione macchina e uscita. -- 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/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/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. -- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste.
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
-- Intestazioni -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -41,7 +42,7 @@ if BEAM.FLAG == 0 then
elseif BEAM.FLAG == 1 then elseif BEAM.FLAG == 1 then
sFlag = 'MODIFY' sFlag = 'MODIFY'
elseif BEAM.FLAG == 2 then elseif BEAM.FLAG == 2 then
sFlag = 'SIMULATE' sFlag = 'SIMULATE'
elseif BEAM.FLAG == 3 then elseif BEAM.FLAG == 3 then
sFlag = 'CHECK' sFlag = 'CHECK'
elseif BEAM.FLAG == 4 then elseif BEAM.FLAG == 4 then
@@ -116,8 +117,7 @@ local function UpdateAuxData( sAuxFile)
end end
-- Imposto direttorio libreria specializzata per Travi -- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir() EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Impostazione della macchina corrente -- Impostazione della macchina corrente
EgtResetCurrMachGroup() EgtResetCurrMachGroup()
@@ -469,6 +469,20 @@ end
-- *** Eseguo simulazione con verifica collisione in cieco *** -- *** Eseguo simulazione con verifica collisione in cieco ***
if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Simulating with collision check >>>') 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() local bSimOk, nErr, sErr = EgtSimulate()
if not bSimOk then if not bSimOk then
if nErr == MCH_SHE.INIT then if nErr == MCH_SHE.INIT then
@@ -507,10 +521,11 @@ end
-- *** Genero programma CN *** ( se richiesto) -- *** Genero programma CN *** ( se richiesto)
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Generating NC part program >>>') EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5 - ' local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
if EgtGetExeVersion then if EgtGetExeVersion then
sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - ' sInfo = sInfo .. ' ver.' .. EgtGetExeVersion()
end end
sInfo = sInfo .. ' - '
if not EgtGenerate( '', sInfo .. sNgeFile) then if not EgtGenerate( '', sInfo .. sNgeFile) then
BEAM.ERR = 20 BEAM.ERR = 20
local _, sName, _ = EgtSplitPath( BEAM.FILE) 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 -- Gestione calcolo batch disposizione e lavorazioni per Travi
-- 2021/01/07 Per nuova interfaccia Egt. -- 2021/01/07 Per nuova interfaccia Egt.
-- 2021/01/15 CREATE_BAR ora FLAG = 6 (prima 5). -- 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/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. -- 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/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 -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -27,7 +31,7 @@ if BEAM.FLAG == 0 then
elseif BEAM.FLAG == 1 then elseif BEAM.FLAG == 1 then
sFlag = 'MODIFY' sFlag = 'MODIFY'
elseif BEAM.FLAG == 2 then elseif BEAM.FLAG == 2 then
sFlag = 'SIMULATE' sFlag = 'SIMULATE'
elseif BEAM.FLAG == 3 then elseif BEAM.FLAG == 3 then
sFlag = 'CHECK' sFlag = 'CHECK'
elseif BEAM.FLAG == 4 then elseif BEAM.FLAG == 4 then
@@ -110,8 +114,7 @@ local function ResetMachGroup( vBeam)
end end
-- Imposto direttorio libreria specializzata per Travi -- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir() EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Se necessario, impostazione della macchina corrente -- Se necessario, impostazione della macchina corrente
local sMachine = BEAM.MACHINE local sMachine = BEAM.MACHINE
@@ -193,7 +196,7 @@ if bToProcess then
return return
end end
-- Faccio copia del file originale -- Faccio copia del file originale
EgtCopyFile( BEAM.FILE, sDir..sTitle..'.ori'..sExt) EgtCopyFile( BEAM.FILE, sOriFile)
-- Aggiorno eventuali dati ausiliari -- Aggiorno eventuali dati ausiliari
--UpdateAuxData( sBtmFile) --UpdateAuxData( sBtmFile)
@@ -286,11 +289,10 @@ if bToProcess then
table.insert( vBeam, { Id = nPartId, PosX = dPosX, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))}) table.insert( vBeam, { Id = nPartId, PosX = dPosX, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
end end
if #vBeam == 0 then if #vBeam == 0 then
--BEAM.ERR = 14 BEAM.ERR = 14
--BEAM.MSG = 'Error : no beams in the project' BEAM.MSG = 'Error : no beams in the project'
--WriteErrToLogFile( BEAM.ERR, BEAM.MSG) WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
--return return
EgtOutLog( 'Travi non trovate', 1)
else else
local sOut = '' local sOut = ''
for i = 1, #vBeam do for i = 1, #vBeam do
@@ -333,8 +335,8 @@ if bToProcess then
for i = 2, #vBeam do for i = 2, #vBeam do
local dDimW = vBeam[i].Box:getDimY() local dDimW = vBeam[i].Box:getDimY()
local dDimH = vBeam[i].Box:getDimZ() local dDimH = vBeam[i].Box:getDimZ()
if ( abs( dDimW - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL) and if ( abs( dDimW - dRawW) > 100 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 100 * GEO.EPS_SMALL) and
( abs( dDimH - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 10 * GEO.EPS_SMALL) then ( abs( dDimH - dRawW) > 100 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 100 * GEO.EPS_SMALL) then
table.insert( vBeamErr, i) table.insert( vBeamErr, i)
end end
end end
@@ -423,17 +425,20 @@ if bToProcess then
-- box del pezzo -- box del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box') local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD) 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 if nPartId then
-- creo o pulisco gruppo geometrie aggiuntive
BL.CreateOrEmptyAddGroup( nPartId) 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 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 -- passo al successivo grezzo
nRawId = EgtGetNextRawPart( nRawId) nRawId = EgtGetNextRawPart( nRawId)
end end
-- elimino le lavorazioni
EgtRemoveAllOperations()
end end
-- Se richiesta solo barra, esco -- Se richiesta solo barra, esco
@@ -455,13 +460,16 @@ if bToProcess then
-- Abilito Vmill -- Abilito Vmill
EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1') EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1')
-- Aggiorno Setup utensili
EgtImportSetup()
-- Lavoro le features -- Lavoro le features
local bPfOk, Stats = BE.ProcessFeatures() local bPfOk, Stats = BE.ProcessFeatures()
local sOutput = '' local sOutput = ''
for i = 1, #Stats do for i = 1, #Stats do
local sMsg = Stats[i].Msg local sMsg = Stats[i].Msg
sMsg = string.gsub( sMsg, '\n', ' ', 10) sMsg = string.gsub( sMsg or '', '\n', ' ', 10)
sMsg = string.gsub( sMsg, '\r', ' ', 10) sMsg = string.gsub( sMsg or '', '\r', ' ', 10)
if Stats[i].Err == 0 then if Stats[i].Err == 0 then
BEAM.ERR = 0 BEAM.ERR = 0
BEAM.MSG = '---' BEAM.MSG = '---'
@@ -519,33 +527,33 @@ else
-- Carico il progetto già fatto -- Carico il progetto già fatto
EgtOpenFile( sNgeFile) EgtOpenFile( sNgeFile)
-- Dichiaro nessun errore -- Dichiaro nessun errore
local nPartId = EgtGetFirstPart() --local nPartId = EgtGetFirstPart()
while nPartId do --while nPartId do
local vDup = EgtDuploList( nPartId) -- local vDup = EgtDuploList( nPartId)
if not vDup or #vDup == 0 then -- if not vDup or #vDup == 0 then
vDup = { nPartId} -- vDup = { nPartId}
end -- end
for i = 1, #vDup do -- for i = 1, #vDup do
local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i') -- local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i')
if nCutId then -- if nCutId then
local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( vDup[i], 'Processings') or GDB_ID.NULL) -- local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( vDup[i], 'Processings') or GDB_ID.NULL)
while nProcId do -- while nProcId do
local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC') -- local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC')
local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i') -- local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i')
if bIsFea and nTaskId then -- if bIsFea and nTaskId then
BEAM.ERR = 0 -- BEAM.ERR = 0
BEAM.MSG = '---' -- BEAM.MSG = '---'
BEAM.ROT = 0 -- BEAM.ROT = 0
BEAM.CUTID = nCutId -- BEAM.CUTID = nCutId
BEAM.TASKID = nTaskId -- BEAM.TASKID = nTaskId
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID) -- WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
end -- end
nProcId = EgtGetNext( nProcId) -- nProcId = EgtGetNext( nProcId)
end -- end
end -- end
end -- end
nPartId = EgtGetNextPart( nPartId) -- nPartId = EgtGetNextPart( nPartId)
end --end
-- Aggiorno eventuali dati ausiliari -- Aggiorno eventuali dati ausiliari
--UpdateAuxData( sBtmFile) --UpdateAuxData( sBtmFile)
-- Passo in modalità lavora -- Passo in modalità lavora
@@ -565,6 +573,20 @@ end
-- *** Eseguo simulazione con verifica collisione in cieco *** -- *** Eseguo simulazione con verifica collisione in cieco ***
if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Simulating with collision check >>>') 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() local bSimOk, nErr, sErr = EgtSimulate()
if not bSimOk then if not bSimOk then
if nErr == MCH_SHE.INIT then if nErr == MCH_SHE.INIT then
@@ -603,10 +625,11 @@ end
-- *** Genero programma CN *** ( se richiesto) -- *** Genero programma CN *** ( se richiesto)
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Generating NC part program >>>') EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5 - ' local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
if EgtGetExeVersion then if EgtGetExeVersion then
sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - ' sInfo = sInfo .. ' ver.' .. EgtGetExeVersion()
end end
sInfo = sInfo .. ' - '
if not EgtGenerate( '', sInfo .. sNgeFile) then if not EgtGenerate( '', sInfo .. sNgeFile) then
BEAM.ERR = 20 BEAM.ERR = 20
local _, sName, _ = EgtSplitPath( BEAM.FILE) local _, sName, _ = EgtSplitPath( BEAM.FILE)
@@ -631,7 +654,7 @@ local Ttot = EgtGetInfo( EgtGetCurrMachGroup(), 'Ttot', 'd')
local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1) local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1)
EgtOutLog( sTime) 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 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 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) 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( ' +++ GetWallData completed')
+485 -193
View File
@@ -1,4 +1,4 @@
-- BeamExec.lua by Egaltech s.r.l. 2021/12/20 -- BeamExec.lua by Egaltech s.r.l. 2022/08/18
-- Libreria esecuzione lavorazioni per Travi -- Libreria esecuzione lavorazioni per Travi
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
-- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato. -- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato.
@@ -25,6 +25,16 @@
-- 2021/11/27 House mortise sempre prima di (dt)mortise, house tenon sempre dopo (dt)tenon. -- 2021/11/27 House mortise sempre prima di (dt)mortise, house tenon sempre dopo (dt)tenon.
-- 2021/12/15 Corretta CompareFeature (risultato deve essere simmetrico scambiando le feature). -- 2021/12/15 Corretta CompareFeature (risultato deve essere simmetrico scambiando le feature).
-- 2021/12/20 Ulteriore correzione a CompareFeature (caso con entrambe senza geometria). -- 2021/12/20 Ulteriore correzione a CompareFeature (caso con entrambe senza geometria).
-- 2022/05/04 Nell'ordinamento quando si confrontano i box delle feature aggiunta verifica preliminare della loro validità.
-- 2022/05/31 Aggiunta gestione sovramateriale per sezioni alte e larghe e informazione di eventuale creazione nuova fase dalla AddFeatureMachining.
-- 2022/06/10 Per sezioni alte e larghe modificata la gestione del sovramateriale per considerare la presenza di feature preesistenti ed
-- eventuale parametro Q05, che determinano la presenza o meno della finitura.
-- Create le funzioni AnalyzeHeadFeatures e AnalyzeTailFeatures. Spostate più in alto le funzioni CollectFeatures, isHeadFeature e isTailFeature.
-- 2022/07/01 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda ad 1 faccia che tagliano tutta la sezione,
-- controllata tramite il parametro IMPROVE_HEAD_TAIL_DRILLINGS da BeamData. Attivata di default.
-- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
-- 2022/08/08 Modifica per macchine senza BD.MAX_WIDTH2 e BD.MAX_HEIGHT2.
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local BeamExec = {} local BeamExec = {}
@@ -79,7 +89,7 @@ _G.package.loaded.ProcessTyroleanDovetail = nil
_G.package.loaded.ProcessDovetail = nil _G.package.loaded.ProcessDovetail = nil
_G.package.loaded.ProcessFreeContour = nil _G.package.loaded.ProcessFreeContour = nil
_G.package.loaded.ProcessDecor = nil _G.package.loaded.ProcessDecor = nil
local BM = require( 'MachiningLib') local ML = require( 'MachiningLib')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local DC = require( 'DiceCut') local DC = require( 'DiceCut')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
@@ -121,11 +131,300 @@ EgtOutLog( ' BeamExec started', 1)
EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC) EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC)
EgtMdbSave() EgtMdbSave()
-------------------------------------------------------------------------------------------------------------
local function IsHeadFeature( Proc, b3Raw, dCurrOvmH)
-- feature sempre di testa o coda per il gruppo
if Proc.Grp == 1 or Proc.Grp == 2 then
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end
-- feature sempre di testa o coda nonostante il gruppo
if ( Proc.Grp == 3 or Proc.Grp == 4) and
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end
-- gestioni speciali
if LapJoint.Identify( Proc) then
return LapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if Drill.Identify( Proc) then
return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if RoundArch.Identify( Proc) then
return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if Dovetail.Identify( Proc) then
return Dovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if FreeContour.Identify( Proc) then
return FreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
-- non è di testa
return false
end
-------------------------------------------------------------------------------------------------------------
local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
-- lunghezza di riferimento per spostare le feature di coda appena prima
local dAdvTailLen = BD.LEN_VERY_SHORT_PART or BD.LEN_SHORT_PART
-- feature sempre di testa o coda per il gruppo (se non troppo lunga)
if Proc.Grp == 1 or Proc.Grp == 2 then
-- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
-- se taglio, lo avanzo
if Proc.Prc == 10 then
return false, true
end
end
-- standard
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH and Proc.Box:getDimX() < BD.MAX_LEN_HTFEA)
end
-- feature sempre di testa o coda nonostante il gruppo
if ( Proc.Grp == 3 or Proc.Grp == 4) and
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
-- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
-- se profilo front solo con smusso, lo avanzo
if Proc.Prc == 100 and ProfFront.OnlyChamfer( Proc) then
return false, true
end
-- se profilo concavo solo con smusso, lo avanzo
if Proc.Prc == 101 and ProfConcave.OnlyChamfer( Proc) then
return false, true
end
-- se profilo convesso solo con smusso, lo avanzo
if Proc.Prc == 102 and ProfConvex.OnlyChamfer( Proc) then
return false, true
end
-- se profilo caudato solo con smusso, lo avanzo
if Proc.Prc == 103 and ProfCamb.OnlyChamfer( Proc) then
return false, true
end
-- se profilo head solo con smusso, lo avanzo
if Proc.Prc == 106 and ProfHead.OnlyChamfer( Proc) then
return false, true
end
end
-- standard
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end
-- gestioni speciali
if LapJoint.Identify( Proc) then
return LapJoint.IsTailFeature( Proc, b3Raw)
end
if Drill.Identify( Proc) then
return Drill.IsTailFeature( Proc, b3Raw, dCurrOvmT)
end
if DtMortise.Identify( Proc) then
return DtMortise.IsTailFeature( Proc, b3Raw)
end
if RoundArch.Identify( Proc) then
return RoundArch.IsTailFeature( Proc, b3Raw)
end
if Dovetail.Identify( Proc) then
return Dovetail.IsTailFeature( Proc, b3Raw)
end
if FreeContour.Identify( Proc) then
return FreeContour.IsTailFeature( Proc, b3Raw)
end
-- non è di coda
return false
end
-------------------------------------------------------------------------------------------------------------
-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra, rappresentata dalle sue dimensioni W e H
local function IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH)
return ((abs(b3Proc:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or b3Proc:getDimY() > dRawW) and (abs(b3Proc:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or b3Proc:getDimZ() > dRawH))
end
-------------------------------------------------------------------------------------------------------------
local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
local dRawW = b3Raw:getDimY()
local dRawH = b3Raw:getDimZ()
-- recupero le feature
local vProc = {}
local LayerId = {}
LayerId[1] = BL.GetAddGroup( PartId)
LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings')
local nMachineBeforeIntersectingDrillingsIdHead, dMachineBeforeIntersectingDrillingsXHead, nMachineBeforeIntersectingDrillingsIdTail, dMachineBeforeIntersectingDrillingsXTail = nil, GEO.INFINITO, nil, -GEO.INFINITO
local b3MachineBeforeIntersectingDrillingsBoxHead, b3MachineBeforeIntersectingDrillingsBoxTail = nil, nil
for nInd = 1, 2 do
local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL)
while ProcId do
local nEntType = EgtGetType( ProcId)
if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or
nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then
local nGrp = EgtGetInfo( ProcId, 'GRP', 'i')
local nPrc = EgtGetInfo( ProcId, 'PRC', 'i')
local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1
local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0
local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0
if nGrp and nPrc and nDo == 1 then
local Proc = {}
Proc.Id = ProcId
Proc.Grp = nGrp
Proc.Prc = nPrc
Proc.Flg = 1
Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0
Proc.Diam = 0
Proc.Fcs = 0
Proc.Fce = 0
Proc.CutId = nCutId
Proc.TaskId = nTaskId
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
if Proc.Box and not Proc.Box:isEmpty() then
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
if Proc.Fct == 1 and IsFeatureCuttingEntireSection( Proc.Box , dRawW, dRawH) and ( Proc.Head or Proc.Tail) and Proc.Prc ~= 340 and Proc.Prc ~= 350 then
if Proc.Head and Proc.Box:getCenter():getX() < dMachineBeforeIntersectingDrillingsXHead then
dMachineBeforeIntersectingDrillingsXHead = Proc.Box:getCenter():getX()
nMachineBeforeIntersectingDrillingsIdHead = Proc.Id
b3MachineBeforeIntersectingDrillingsBoxHead = Proc.Box
elseif Proc.Tail and Proc.Box:getCenter():getX() > dMachineBeforeIntersectingDrillingsXTail then
dMachineBeforeIntersectingDrillingsXTail = Proc.Box:getCenter():getX()
nMachineBeforeIntersectingDrillingsIdTail = Proc.Id
b3MachineBeforeIntersectingDrillingsBoxTail = Proc.Box
end
end
table.insert( vProc, Proc)
-- se foro
if Drill.Identify( Proc) then
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw)
-- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta
if Drill.Split( Proc, b3Raw) then
-- aggiorno flags prima parte foro (dati tabelle sempre per riferimento)
Proc.Flg = 2
Proc.Head = Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
Proc.Tail = Drill.IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
-- definisco dati seconda parte
local Proc2 = {}
Proc2.Id = ProcId
Proc2.Grp = nGrp
Proc2.Prc = nPrc
Proc2.Flg = -2
Proc2.Box = BBox3d( Proc.Box)
Proc2.Fct = Proc.Fct
Proc2.Diam = Proc.Diam
Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH)
Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH)
Proc2.Fcs = Proc.Fce
Proc2.Fce = Proc.Fcs
Proc2.CutId = Proc.CutId
Proc2.TaskId = Proc.TaskId
table.insert( vProc, Proc2)
end
-- se BlockHaus HalfLap
elseif Proc.Prc == 37 then
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId)
if nFacInd then
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN then
Proc.vtN = Vector3d( vtN)
end
end
end
else
Proc.Head = false
Proc.Tail = false
Proc.Flg = 0
table.insert( vProc, Proc)
EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)')
end
end
end
ProcId = EgtGetNext( ProcId)
end
end
local vMachineBeforeIntersectingDrillings = {
Head = { Id = nMachineBeforeIntersectingDrillingsIdHead, Box = b3MachineBeforeIntersectingDrillingsBoxHead},
Tail = { Id = nMachineBeforeIntersectingDrillingsIdTail, Box = b3MachineBeforeIntersectingDrillingsBoxTail}
}
return vProc, vMachineBeforeIntersectingDrillings
end
-------------------------------------------------------------------------------------------------------------
local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
local nReplacedFeatureId = nil
local bHeadFinishingNeeded = true
for i = 1, #vProc do
local Proc = vProc[i]
-- controllo se esiste già una feature taglio di testa
if not nReplacedFeatureId then
if ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10 then
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
if ptC and vtN and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL then
nReplacedFeatureId = Proc.Id
end
end
end
if Proc.Head and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 340 then
-- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria
bHeadFinishingNeeded = not IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
end
end
return bHeadFinishingNeeded, nReplacedFeatureId
end
-------------------------------------------------------------------------------------------------------------
local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
local nReplacedFeatureId = nil
local bTailFinishingNeeded = true
for i = 1, #vProc do
local Proc = vProc[i]
-- controllo se esistè già una feature taglio di coda
if not nReplacedFeatureId then
if ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10 then
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
if ptC and vtN and AreSameVectorApprox( vtN, -X_AX()) and abs( ptC:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL then
nReplacedFeatureId = Proc.Id
end
end
end
if Proc.Tail and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 350 then
-- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria
bTailFinishingNeeded = not IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
end
end
return bTailFinishingNeeded, nReplacedFeatureId
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle travi nel grezzo *** -- *** Inserimento delle travi nel grezzo ***
-------------------------------------------------------------------------------------------------------------
local function VerifyBigSectionCut( dRawW, dRawH)
-- lama principale
local sCutting = ML.FindCutting( 'TailSide')
local dMaxDepth = 50
if EgtMdbSetCurrMachining( sCutting or '') then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid or '') or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- eventuale lama su testa sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
local dMaxDepth2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- verifiche
local dDimYRef = EgtIf( dRawH < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( dRawW > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( dRawH > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
return bBigSectionCut
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk) function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk)
-- default per nuove costanti qualora non definite
BD.OVM_BLADE_HBEAM = ( BD.OVM_BLADE_HBEAM or 11)
BD.OVM_CHAIN_HBEAM = ( BD.OVM_CHAIN_HBEAM or 8)
-- Determinazione minimo grezzo scaricabile -- Determinazione minimo grezzo scaricabile
BeamExec.CalcMinUnloadableRaw( dRawW, dRawH) BeamExec.CalcMinUnloadableRaw( dRawW, dRawH)
@@ -156,7 +455,10 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
local Len = dRawL local Len = dRawL
local nPrevRaw, dPrevDelta local nPrevRaw, dPrevDelta
local DeltaS = dOvmHead local DeltaS = dOvmHead
local DeltaSMin = 0
local DeltaE = BD.OVM_MID local DeltaE = BD.OVM_MID
-- controllo sezione larga e alta per considerare taglio con sega a catena
local bBigSectionCut = VerifyBigSectionCut( dRawW, dRawH)
for i = 1, #vBeam do for i = 1, #vBeam do
-- assegno identificativo pezzo -- assegno identificativo pezzo
local Pz = vBeam[i].Id local Pz = vBeam[i].Id
@@ -164,18 +466,49 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT) local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT)
local b3Solid = vBeam[i].Box local b3Solid = vBeam[i].Box
if b3Part:isEmpty() or b3Solid:isEmpty() then break end if b3Part:isEmpty() or b3Solid:isEmpty() then break end
if bBigSectionCut then
-- lascio in coda solo il materiale necessario; il resto verrà tolto nell'head cut successivo
local lastB3Solid = nil
local dOffset = dOvmHead
if i > 1 then
lastB3Solid = vBeam[i-1].Box
dOffset = vBeam[i].PosX - vBeam[i-1].PosX - lastB3Solid:getDimX()
end
-- analizzo le features per valutare l'esistenza di feature head/tail che renderebbero inutili le rispettive finiture o di tagli di testa/coda sostituiti da cui leggere il parametro Q05
local vProc = CollectFeatures( Pz, b3Solid, 0)
local bSFinishingNeeded, nReplacedHeadCutFeatureId = AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
local iSQ05Value = nil
if nReplacedHeadCutFeatureId then
iSQ05Value = EgtGetInfo( nReplacedHeadCutFeatureId, 'Q05', 'i')
end
if ( dOffset <= BD.OVM_CHAIN_HBEAM and iSQ05Value == 0) or not bSFinishingNeeded then
DeltaSMin = 0
else
DeltaSMin = BD.OVM_BLADE_HBEAM
end
local bEFinishingNeeded, nReplacedTailCutFeatureId = AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
local iEQ05Value = nil
if nReplacedTailCutFeatureId then
iEQ05Value = EgtGetInfo( nReplacedTailCutFeatureId, 'Q05', 'i')
end
if iEQ05Value == 0 or not bEFinishingNeeded then
DeltaE = BD.OVM_CHAIN_HBEAM
else
DeltaE = BD.OVM_CHAIN_HBEAM + BD.OVM_BLADE_HBEAM
end
end
EgtOutLog( 'PartSez=' .. EgtNumToString( b3Part:getDimY(), 1) .. 'x' .. EgtNumToString( b3Part:getDimZ(), 1), 3) EgtOutLog( 'PartSez=' .. EgtNumToString( b3Part:getDimY(), 1) .. 'x' .. EgtNumToString( b3Part:getDimZ(), 1), 3)
-- se sezione compatibile e lunghezza disponibile sufficiente -- se sezione compatibile e lunghezza disponibile sufficiente
local PartLen = b3Solid:getDimX() local PartLen = b3Solid:getDimX()
local PartWidth = b3Solid:getDimY() local PartWidth = b3Solid:getDimY()
local PartHeight = b3Solid:getDimZ() local PartHeight = b3Solid:getDimZ()
local NextLen = Len - DeltaS - PartLen - DeltaE local NextLen = Len - DeltaS - PartLen - DeltaE
if (( abs( PartWidth - dRawW) < 10 * GEO.EPS_SMALL and abs( PartHeight - dRawH) < 10 * GEO.EPS_SMALL) or if (( abs( PartWidth - dRawW) < 100 * GEO.EPS_SMALL and abs( PartHeight - dRawH) < 100 * GEO.EPS_SMALL) or
( abs( PartHeight - dRawW) < 10 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 10 * GEO.EPS_SMALL)) and ( abs( PartHeight - dRawW) < 100 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 100 * GEO.EPS_SMALL)) and
NextLen + DeltaE >= 0 then NextLen + DeltaE >= 0 then
-- eventuale sovramateriale di testa -- eventuale sovramateriale di testa
if vBeam[i].PosX then if i > 1 and vBeam[i].PosX then
DeltaS = max( vBeam[i].PosX - ( dRawL - Len), 0) DeltaS = max( vBeam[i].PosX - ( dRawL - Len), DeltaSMin)
end end
-- dimensioni del grezzo -- dimensioni del grezzo
local CrawLen = min( PartLen + DeltaS + DeltaE, Len) local CrawLen = min( PartLen + DeltaS + DeltaE, Len)
@@ -201,13 +534,16 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
EgtSetInfo( nPrevRaw, 'BDST', DeltaS + dPrevDelta) EgtSetInfo( nPrevRaw, 'BDST', DeltaS + dPrevDelta)
end end
end end
if DeltaE > 0.09 then
EgtSetInfo( nRaw, 'TOVM', DeltaE)
end
-- aggiungo faccia per taglio finale al pezzo -- aggiungo faccia per taglio finale al pezzo
BL.AddPartEndFace( Pz, b3Solid) BL.AddPartEndFace( Pz, b3Solid)
-- inserisco il pezzo nel grezzo -- inserisco il pezzo nel grezzo
EgtDeselectPartObjs( Pz) EgtDeselectPartObjs( Pz)
local ptPos = b3Part:getMin() - b3Solid:getMin() + Vector3d( Delta, ( dRawW - PartWidth) / 2, ( dRawH - PartHeight) / 2) local ptPos = b3Part:getMin() - b3Solid:getMin() + Vector3d( Delta, ( dRawW - PartWidth) / 2, ( dRawH - PartHeight) / 2)
EgtAddPartToRawPart( Pz, ptPos, nRaw) EgtAddPartToRawPart( Pz, ptPos, nRaw)
if abs( PartWidth - dRawW) > 10 * GEO.EPS_SMALL then if abs( PartWidth - dRawW) > 100 * GEO.EPS_SMALL then
-- rotazione attorno a centro geometria complessiva del pezzo -- rotazione attorno a centro geometria complessiva del pezzo
EgtRotatePartInRawPart( Pz, X_AX(), 90) EgtRotatePartInRawPart( Pz, X_AX(), 90)
-- correggo per eccentricità solido rispetto a geometria complessiva del pezzo -- correggo per eccentricità solido rispetto a geometria complessiva del pezzo
@@ -221,6 +557,9 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
-- aggiorno grezzo precedente -- aggiorno grezzo precedente
nPrevRaw = nRaw nPrevRaw = nRaw
dPrevDelta = Delta dPrevDelta = Delta
else
local sOut = 'Error: part L(' .. EgtNumToString( PartLen, 1) .. ') too big for raw part L(' .. EgtNumToString( Len - 0.1, 1) .. ')'
return false, sOut
end end
-- se rimasto troppo poco grezzo, esco -- se rimasto troppo poco grezzo, esco
--if Len < BD.MinRaw then break end --if Len < BD.MinRaw then break end
@@ -271,73 +610,12 @@ local function Verify90DegRotation( nRawId)
local dRawW = EgtGetRawPartBBox( nRawId):getDimY() local dRawW = EgtGetRawPartBBox( nRawId):getDimY()
local dRawH = EgtGetRawPartBBox( nRawId):getDimZ() local dRawH = EgtGetRawPartBBox( nRawId):getDimZ()
-- verifica dell'altezza rispetto alla massima larghezza -- verifica dell'altezza rispetto alla massima larghezza
return ( dRawH < BD.MAX_WIDTH + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL) or if not BD.MAX_WIDTH2 or not BD.MAX_HEIGHT2 then
( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL) return ( dRawH < BD.MAX_WIDTH + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL)
end else
return ( dRawH < BD.MAX_WIDTH + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL) or
------------------------------------------------------------------------------------------------------------- ( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL)
local function IsHeadFeature( Proc, b3Raw, dCurrOvmH)
-- feature sempre di testa o coda per il gruppo
if Proc.Grp == 1 or Proc.Grp == 2 then
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end end
-- feature sempre di testa o coda nonostante il gruppo
if ( Proc.Grp == 3 or Proc.Grp == 4) and
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end
-- gestioni speciali
if LapJoint.Identify( Proc) then
return LapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if Drill.Identify( Proc) then
return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if RoundArch.Identify( Proc) then
return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if Dovetail.Identify( Proc) then
return Dovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
if FreeContour.Identify( Proc) then
return FreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
-- non è di testa
return false
end
-------------------------------------------------------------------------------------------------------------
local function IsTailFeature( Proc, b3Raw, dCurrOvmH)
-- feature sempre di testa o coda per il gruppo (se non troppo lunga)
if Proc.Grp == 1 or Proc.Grp == 2 then
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH and Proc.Box:getDimX() < BD.MAX_LEN_HTFEA)
end
-- feature sempre di testa o coda nonostante il gruppo
if ( Proc.Grp == 3 or Proc.Grp == 4) and
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
end
-- gestioni speciali
if LapJoint.Identify( Proc) then
return LapJoint.IsTailFeature( Proc, b3Raw)
end
if Drill.Identify( Proc) then
return Drill.IsTailFeature( Proc, b3Raw)
end
if DtMortise.Identify( Proc) then
return DtMortise.IsTailFeature( Proc, b3Raw)
end
if RoundArch.Identify( Proc) then
return RoundArch.IsTailFeature( Proc, b3Raw)
end
if Dovetail.Identify( Proc) then
return Dovetail.IsTailFeature( Proc, b3Raw)
end
if FreeContour.Identify( Proc) then
return FreeContour.IsTailFeature( Proc, b3Raw)
end
-- non è di coda
return false
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
@@ -347,7 +625,8 @@ local function PrintFeatures( vProc, b3Raw)
local Proc = vProc[i] local Proc = vProc[i]
local sOut = string.format( ' Id=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Down=%s Side=%s Head=%s Tail=%s Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s', local sOut = string.format( ' Id=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Down=%s Side=%s Head=%s Tail=%s Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s',
Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId, Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId,
Proc.Flg, EgtIf( Proc.Down, 'T', 'F'), EgtIf( Proc.Side, 'T', 'F'), EgtIf( Proc.Head, 'T', 'F'), EgtIf( Proc.Tail, 'T', 'F'), Proc.Flg, EgtIf( Proc.Down, 'T', 'F'), EgtIf( Proc.Side, 'T', 'F'),
EgtIf( Proc.Head, 'T', 'F'), EgtIf( Proc.Tail, 'T', EgtIf( Proc.AdvTail, 'A', 'F')),
Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box)) Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box))
-- info speciali per Block Haus Half Lap -- info speciali per Block Haus Half Lap
if Proc.Prc == 37 then if Proc.Prc == 37 then
@@ -358,93 +637,6 @@ local function PrintFeatures( vProc, b3Raw)
end end
end end
-------------------------------------------------------------------------------------------------------------
local function CollectFeatures( PartId, b3Raw, dCurrOvmH)
-- recupero le feature
local vProc = {}
local LayerId = {}
LayerId[1] = BL.GetAddGroup( PartId)
LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings')
for nInd = 1, 2 do
local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL)
while ProcId do
local nEntType = EgtGetType( ProcId)
if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or
nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then
local nGrp = EgtGetInfo( ProcId, 'GRP', 'i')
local nPrc = EgtGetInfo( ProcId, 'PRC', 'i')
local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1
local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0
local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0
if nGrp and nPrc and nDo == 1 then
local Proc = {}
Proc.Id = ProcId
Proc.Grp = nGrp
Proc.Prc = nPrc
Proc.Flg = 1
Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0
Proc.Diam = 0
Proc.Fcs = 0
Proc.Fce = 0
Proc.CutId = nCutId
Proc.TaskId = nTaskId
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
if Proc.Box and not Proc.Box:isEmpty() then
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
Proc.Tail = IsTailFeature( Proc, b3Raw, dCurrOvmH)
table.insert( vProc, Proc)
-- se foro
if Drill.Identify( Proc) then
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw)
-- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta
if Drill.Split( Proc, b3Raw) then
-- aggiorno flags prima parte foro (dati tabelle sempre per riferimento)
Proc.Flg = 2
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
Proc.Tail = IsTailFeature( Proc, b3Raw, dCurrOvmH)
-- definisco dati seconda parte
local Proc2 = {}
Proc2.Id = ProcId
Proc2.Grp = nGrp
Proc2.Prc = nPrc
Proc2.Flg = -2
Proc2.Box = BBox3d( Proc.Box)
Proc2.Fct = Proc.Fct
Proc2.Diam = Proc.Diam
Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH)
Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH)
Proc2.Fcs = Proc.Fce
Proc2.Fce = Proc.Fcs
Proc2.CutId = Proc.CutId
Proc2.TaskId = Proc.TaskId
table.insert( vProc, Proc2)
end
-- se BlockHaus HalfLap
elseif Proc.Prc == 37 then
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId)
if nFacInd then
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN then
Proc.vtN = Vector3d( vtN)
end
end
end
else
Proc.Head = false
Proc.Tail = false
Proc.Flg = 0
table.insert( vProc, Proc)
EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)')
end
end
end
ProcId = EgtGetNext( ProcId)
end
end
return vProc
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function OrderFeatures( vProc, b3Raw) local function OrderFeatures( vProc, b3Raw)
@@ -511,6 +703,14 @@ local function OrderFeatures( vProc, b3Raw)
if B2.Tail and ( Split.Identify( B1) or not B1.Tail) then if B2.Tail and ( Split.Identify( B1) or not B1.Tail) then
return true return true
end end
-- se primo è feature di coda anticipata e l'altro non è feature di coda
if B1.AdvTail and ( not Split.Identify( B2) or not B2.Tail) then
return false
end
-- se secondo è feature di coda anticipata e l'altro non è feature di coda
if B2.AdvTail and ( not Split.Identify( B1) or not B1.Tail) then
return true
end
-- se primo è scasso o mortasa di coda e secondo no, sempre dopo -- se primo è scasso o mortasa di coda e secondo no, sempre dopo
if B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and if B1.Tail and ( LapJoint.Identify( B1) or Mortise.Identify( B1) or DtMortise.Identify( B1)) and
not ( B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2))) then not ( B2.Tail and ( LapJoint.Identify( B2) or Mortise.Identify( B2) or DtMortise.Identify( B2))) then
@@ -523,9 +723,13 @@ local function OrderFeatures( vProc, b3Raw)
end end
-- se primo è taglio longitudinale completo o altra lav. lunga, dopo tutte le altre feature non di coda -- se primo è taglio longitudinale completo o altra lav. lunga, dopo tutte le altre feature non di coda
if abs( B1.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then if abs( B1.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then
-- se anche l'altra è lunga, faccio prima quello a Zmax -- se anche l'altra è lunga, faccio prima quello piccolo in YZ
if abs( B2.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then if abs( B2.Box:getDimX() - b3Raw:getDimX()) < 0.2 * b3Raw:getDimX() then
return B1.Box:getMax():getZ() > B2.Box:getMax():getZ() if abs( B1.Box:getDimY() * B1.Box:getDimZ() - B2.Box:getDimY() * B2.Box:getDimZ()) < 10 then
return B1.Id < B2.Id
else
return B1.Box:getDimY() * B1.Box:getDimZ() < B2.Box:getDimY() * B2.Box:getDimZ()
end
else else
return B2.Tail or B1.Box:getMin():getX() + 20 > B2.Box:getCenter():getX() return B2.Tail or B1.Box:getMin():getX() + 20 > B2.Box:getCenter():getX()
end end
@@ -609,10 +813,13 @@ local function OrderFeatures( vProc, b3Raw)
end end
for i = 1, #vProc do for i = 1, #vProc do
local ProcI = vProc[i] local ProcI = vProc[i]
if ProcI.Prc == 40 then if ProcI.Prc == 40 and
ProcI.Box and not ProcI.Box:isEmpty() then
for j = i + 1, #vProc do for j = i + 1, #vProc do
local ProcJ = vProc[j] local ProcJ = vProc[j]
if ProcJ.Prc == 40 and ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and if ProcJ.Prc == 40 and
ProcJ.Box and not ProcJ.Box:isEmpty() and
ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and
abs( ProcJ.Diam - ProcI.Diam) < 1.0 and abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dDrillRange then abs( ProcJ.Diam - ProcI.Diam) < 1.0 and abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dDrillRange then
if j > i + 1 then if j > i + 1 then
local ProcK = vProc[i+1] local ProcK = vProc[i+1]
@@ -646,10 +853,12 @@ local function OrderFeatures( vProc, b3Raw)
local dMarkRange = 300 local dMarkRange = 300
for i = 1, #vProc do for i = 1, #vProc do
local ProcI = vProc[i] local ProcI = vProc[i]
if ProcI.Prc == 60 or ProcI.Prc == 61 or ProcI.Prc == 959 then if ( ProcI.Prc == 60 or ProcI.Prc == 61 or ProcI.Prc == 959) and
ProcI.Box and not ProcI.Box:isEmpty() then
for j = i + 1, #vProc do for j = i + 1, #vProc do
local ProcJ = vProc[j] local ProcJ = vProc[j]
if ( ProcJ.Prc == 60 or ProcJ.Prc == 61 or ProcJ.Prc == 959) and if ( ProcJ.Prc == 60 or ProcJ.Prc == 61 or ProcJ.Prc == 959) and
ProcJ.Box and not ProcJ.Box:isEmpty() and
ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and
abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dMarkRange then abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dMarkRange then
if j > i + 1 then if j > i + 1 then
@@ -664,10 +873,13 @@ local function OrderFeatures( vProc, b3Raw)
local dBHHLRange = 100 local dBHHLRange = 100
for i = 1, #vProc do for i = 1, #vProc do
local ProcI = vProc[i] local ProcI = vProc[i]
if ProcI.Prc == 37 then if ProcI.Prc == 37 and
ProcI.Box and not ProcI.Box:isEmpty() then
for j = i + 1, #vProc do for j = i + 1, #vProc do
local ProcJ = vProc[j] local ProcJ = vProc[j]
if ProcJ.Prc == 37 and abs( ProcI.Box:getCenter():getX() - ProcJ.Box:getCenter():getX()) < dBHHLRange then if ProcJ.Prc == 37 and
ProcJ.Box and not ProcJ.Box:isEmpty() and
abs( ProcI.Box:getCenter():getX() - ProcJ.Box:getCenter():getX()) < dBHHLRange then
if ProcI.HeadDir then if ProcI.HeadDir then
if ProcJ.vtN:getY() < -0.5 then if ProcJ.vtN:getY() < -0.5 then
table.insert( vProc, i, table.remove( vProc, j)) table.insert( vProc, i, table.remove( vProc, j))
@@ -705,12 +917,18 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
local bSplitRot = false local bSplitRot = false
local nHeading local nHeading
local nSplitting local nSplitting
local vMachineBeforeIntersectingDrillingsId = {}
for i = 1, #vProc do for i = 1, #vProc do
local Proc = vProc[i] local Proc = vProc[i]
local bOk = true local bOk = true
local bDown = false local bDown = false
local bSide = false local bSide = false
local bDownSideOnHeadOk = false local bDownSideOnHeadOk = false
if Proc.MachineBeforeIntersectingDrillings then
table.Insert ( vMachineBeforeIntersectingDrillingsId, Proc.Id)
end
-- se senza geometria (già disabilitato -- se senza geometria (già disabilitato
if Proc.Flg == 0 then if Proc.Flg == 0 then
bOk = false bOk = false
@@ -872,10 +1090,10 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw) local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
local bOk = true local bOk = true
local sErr = '' local sErr = ''
local bNewPhase = false local nNewPhase = -1
EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1) EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1)
-- se intestatura ( 1-340-X ) -- se intestatura ( 1-340-X )
if Hcut.Identify( Proc) then if Hcut.Identify( Proc) then
@@ -884,13 +1102,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se separazione ( 2-350-X ) -- se separazione ( 2-350-X )
elseif Split.Identify( Proc) then elseif Split.Identify( Proc) then
-- esecuzione separazione o eliminazione grezzo residuo -- esecuzione separazione o eliminazione grezzo residuo
bOk, sErr = Split.Make( Proc, nPhase, nRawId, nPartId) bOk, sErr, nNewPhase = Split.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
-- richiedo il passaggio alla seconda fase di lavorazione di questa trave
bNewPhase = true
-- se taglio ( 1/2-010-X) -- se taglio ( 1/2-010-X)
elseif Cut.Identify( Proc) then elseif Cut.Identify( Proc) then
-- esecuzione taglio -- esecuzione taglio
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, nil, nil, nil, nil, nil, dCurrOvmT)
-- se doppio taglio ( 1/2-011-X) -- se doppio taglio ( 1/2-011-X)
elseif DoubleCut.Identify( Proc) then elseif DoubleCut.Identify( Proc) then
-- esecuzione doppio taglio -- esecuzione doppio taglio
@@ -911,7 +1127,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se taglio con lama ( 0/3/4-013-X) -- se taglio con lama ( 0/3/4-013-X)
elseif SawCut.Identify( Proc) then elseif SawCut.Identify( Proc) then
-- esecuzione taglio -- esecuzione taglio
bOk, sErr = SawCut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bOk, sErr = SawCut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se mezzo-legno di testa ( 1/2-030-X) -- se mezzo-legno di testa ( 1/2-030-X)
elseif RidgeLap.Identify( Proc) then elseif RidgeLap.Identify( Proc) then
-- esecuzione mezzo-legno di testa -- esecuzione mezzo-legno di testa
@@ -933,11 +1149,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se giunzione francese ( 1/2-035-X) -- se giunzione francese ( 1/2-035-X)
elseif FrenchRidgeLap.Identify( Proc) then elseif FrenchRidgeLap.Identify( Proc) then
-- esecuzione giunzione francese -- esecuzione giunzione francese
bOk, sErr = FrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bOk, sErr = FrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se block house front ( 3/4-038-X) -- se block house front ( 3/4-038-X)
elseif BlockHausFront.Identify( Proc) then elseif BlockHausFront.Identify( Proc) then
-- esecuzione giunzione francese -- esecuzione giunzione francese
bOk, sErr = BlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bOk, sErr = BlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se tenone ( 1/2-050-X) -- se tenone ( 1/2-050-X)
elseif Tenon.Identify( Proc) then elseif Tenon.Identify( Proc) then
-- esecuzione tenone -- esecuzione tenone
@@ -965,11 +1181,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se giunto Gerber ( 1/2-071-X) -- se giunto Gerber ( 1/2-071-X)
elseif ScarfJoint.Identify( Proc) then elseif ScarfJoint.Identify( Proc) then
-- esecuzione giunto Gerber -- esecuzione giunto Gerber
bOk, sErr = ScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bOk, sErr = ScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se giunto Gerber ( 1/2-070-X) -- se giunto Gerber ( 1/2-070-X)
elseif Scarf.Identify( Proc) then elseif Scarf.Identify( Proc) then
-- esecuzione giunto Gerber -- esecuzione giunto Gerber
bOk, sErr = Scarf.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bOk, sErr = Scarf.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se giunto a gradino ( 1/2-080-X) -- se giunto a gradino ( 1/2-080-X)
elseif StepJoint.Identify( Proc) then elseif StepJoint.Identify( Proc) then
-- esecuzione giunto a gradino -- esecuzione giunto a gradino
@@ -1004,10 +1220,10 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
bOk, sErr = ProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bOk, sErr = ProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se incastro tirolo ( 1/2/3/4-136-X) -- se incastro tirolo ( 1/2/3/4-136-X)
elseif TyroleanDovetail.Identify( Proc) then elseif TyroleanDovetail.Identify( Proc) then
bOk, sErr = TyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bOk, sErr = TyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se giunto coda di rondine ( 1/2/3/4-138-X) -- se giunto coda di rondine ( 1/2/3/4-138-X)
elseif Dovetail.Identify( Proc) then elseif Dovetail.Identify( Proc) then
bOk, sErr = Dovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bOk, sErr = Dovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
-- se contorno libero ( 0/3/4-250-X) -- se contorno libero ( 0/3/4-250-X)
elseif FreeContour.Identify( Proc) then elseif FreeContour.Identify( Proc) then
-- esecuzione contorno -- esecuzione contorno
@@ -1022,7 +1238,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
EgtOutLog( sErr) EgtOutLog( sErr)
bOk = false bOk = false
end end
return bOk, sErr, bNewPhase return bOk, sErr, nNewPhase
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
@@ -1129,8 +1345,68 @@ local function MoveDrillsOnTenon( vProc)
end end
end end
-------------------------------------------------------------------------------------------------------------
-- verifica se ci sono forature da lavorare dopo tagli di testa o coda e nel caso le classifica come Head o Tail e gli assegna l'Id della rispettiva feature di taglio
local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
for i = 1, #vProc do
if Drill.Identify( vProc[i]) then
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( vProc[i].Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + vProc[i].Id end
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
return false
end
-- recupero il vettore estrusione
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local bOpen = ( vProc[i].Fcs ~= 0 and vProc[i].Fce ~= 0)
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
local vDistHead, vDistTail
-- check intersezione con feature di testa
if vMachineBeforeIntersectingDrillings.Head.Id then
-- verifico che ci sia intersezione tra la feature foro e la feature taglio di testa
local bIntersectionWithHead =
vMachineBeforeIntersectingDrillings.Head.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Head.Box:getMax():getX() + 100 * GEO.EPS_SMALL and
vMachineBeforeIntersectingDrillings.Head.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL
-- verifico che ci sia intersezione tra la direzione di estrusione e la faccia della feature taglio di testa
if bIntersectionWithHead then
_, _, vDistHead = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Head.Id, GDB_RT.GLOB)
end
end
-- check intersezione con feature di coda
if vMachineBeforeIntersectingDrillings.Tail.Id then
-- verifico che ci sia intersezione tra la feature foro e la feature taglio di coda
local bIntersectionWithTail =
vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and
vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL
-- verifico che ci sia intersezione tra la direzione di estrusione e la faccia della feature taglio di coda
if bIntersectionWithTail then
_, _, vDistTail = EgtLineSurfTmInters( ptCen, -vtExtr, vMachineBeforeIntersectingDrillings.Tail.Id, GDB_RT.GLOB)
end
end
-- se esiste intersezione tra il foro e la feature di testa
if vDistHead and #vDistHead > 0 then
-- verifico che il foro sia di testa
if ( bOpen or ( not bOpen and vtExtr:getX() > 0 and vProc[i].Fcs ~= 0) or ( not bOpen and vtExtr:getX() < 0 and vProc[i].Fce ~= 0)) then
vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id
vProc[i].Head = true
end
-- se esiste intersezione tra il foro e la feature di coda
elseif vDistTail and #vDistTail > 0 then
-- verifico che il foro sia di coda
if ( bOpen or ( not bOpen and vtExtr:getX() < 0 and vProc[i].Fcs ~= 0) or ( not bOpen and vtExtr:getX() > 0 and vProc[i].Fce ~= 0)) then
vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id
vProc[i].Tail = true
end
end
end
end
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamExec.ProcessFeatures() function BeamExec.ProcessFeatures()
if BD.IMPROVE_HEAD_TAIL_DRILLINGS == nil then
BD.IMPROVE_HEAD_TAIL_DRILLINGS = true
end
-- verifica se possibile rotazione di 90 gradi -- verifica se possibile rotazione di 90 gradi
BD.ROT90 = BD.ROT90 and Verify90DegRotation( EgtGetFirstRawPart()) BD.ROT90 = BD.ROT90 and Verify90DegRotation( EgtGetFirstRawPart())
-- ciclo sui pezzi -- ciclo sui pezzi
@@ -1156,8 +1432,13 @@ function BeamExec.ProcessFeatures()
-- ingombro del grezzo e sovramateriale di testa -- ingombro del grezzo e sovramateriale di testa
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', 'd') or 0 local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', 'd') or 0
local dCurrOvmT = EgtGetInfo( nRawId, 'TOVM', 'd') or 0
-- recupero le feature di lavorazione della trave -- recupero le feature di lavorazione della trave
local vProc = CollectFeatures( nPartId, b3Raw, dCurrOvmH) local vProc, vMachineBeforeIntersectingDrillings = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT)
-- verifica presenza forature influenzate da lavorazioni di testa o coda
if BD.IMPROVE_HEAD_TAIL_DRILLINGS then
SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
end
-- le ordino lungo X -- le ordino lungo X
OrderFeatures( vProc, b3Raw) OrderFeatures( vProc, b3Raw)
-- le classifico -- le classifico
@@ -1176,8 +1457,11 @@ function BeamExec.ProcessFeatures()
SetCutsOnFrontMortises( vProc) SetCutsOnFrontMortises( vProc)
-- eventuale spostamento fori sui tenoni -- eventuale spostamento fori sui tenoni
MoveDrillsOnTenon( vProc) MoveDrillsOnTenon( vProc)
-- identifico la condizione di lavorazione, in base a bSomeDown e bSomeSide
local sDownOrSideOrStd = 'STD'
-- se richiesto ribaltamento (oppure rotazione) -- se richiesto ribaltamento (oppure rotazione)
if ( bSomeDown or bSomeSide) and not BD.DOWN_HEAD then if ( bSomeDown or bSomeSide) and not BD.DOWN_HEAD and not BD.TURN then
sDownOrSideOrStd = 'DOWN'
-- ribalto le travi della fase corrente -- ribalto le travi della fase corrente
local nRId = nRawId local nRId = nRawId
while nRId do while nRId do
@@ -1190,7 +1474,7 @@ function BeamExec.ProcessFeatures()
-- creo la lavorazione -- creo la lavorazione
local Proc = vProc[i] local Proc = vProc[i]
if Proc.Flg ~= 0 and Proc.Down then if Proc.Flg ~= 0 and Proc.Down then
local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw) local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
if not bOk then if not bOk then
nTotErr = nTotErr + 1 nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1199,8 +1483,10 @@ function BeamExec.ProcessFeatures()
else else
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
end end
-- se era taglio di separazione, aggiungo nuova fase -- se è taglio di separazione, verifico se ha già aggiunto una nuova fase oppure se è da creare
if bNewPhase then if nNewPhase > 0 then
nPhase = nNewPhase
elseif nNewPhase == 0 then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET) BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
EgtRotateRawPart( nRawId, X_AX(), 180) EgtRotateRawPart( nRawId, X_AX(), 180)
-- se grezzo successivo senza pezzi e finale, va tolto -- se grezzo successivo senza pezzi e finale, va tolto
@@ -1237,7 +1523,8 @@ function BeamExec.ProcessFeatures()
EgtSetInfo( nDispId, 'ORD', nOrd) EgtSetInfo( nDispId, 'ORD', nOrd)
end end
-- se richiesta rotazione -- se richiesta rotazione
if bSomeSide and not BD.DOWN_HEAD then if bSomeSide and not BD.DOWN_HEAD and not BD.TURN then
sDownOrSideOrStd = 'SIDE'
-- vettore movimento grezzi per rotazione di 90deg -- vettore movimento grezzi per rotazione di 90deg
local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ() local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ()
local vtMove = Vector3d( 0, dDeltaYZ / 2, dDeltaYZ / 2) local vtMove = Vector3d( 0, dDeltaYZ / 2, dDeltaYZ / 2)
@@ -1257,7 +1544,7 @@ function BeamExec.ProcessFeatures()
-- creo la lavorazione -- creo la lavorazione
local Proc = vProc[i] local Proc = vProc[i]
if Proc.Flg ~= 0 and Proc.Side then if Proc.Flg ~= 0 and Proc.Side then
local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw) local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
if not bOk then if not bOk then
nTotErr = nTotErr + 1 nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1268,7 +1555,9 @@ function BeamExec.ProcessFeatures()
end end
if bOk then nSideMchOk = nSideMchOk + 1 end if bOk then nSideMchOk = nSideMchOk + 1 end
-- se era taglio di separazione, aggiungo nuova fase -- se era taglio di separazione, aggiungo nuova fase
if bNewPhase then if nNewPhase > 0 then
nPhase = nNewPhase
elseif nNewPhase == 0 then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET) BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90)) EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
@@ -1307,12 +1596,13 @@ function BeamExec.ProcessFeatures()
EgtSetInfo( nDispId, 'TYPE', EgtIf( not bSplitRot, 'MID', 'END2')) EgtSetInfo( nDispId, 'TYPE', EgtIf( not bSplitRot, 'MID', 'END2'))
EgtSetInfo( nDispId, 'ORD', nOrd) EgtSetInfo( nDispId, 'ORD', nOrd)
end end
sDownOrSideOrStd = 'STD'
-- inserisco le lavorazioni non ribaltate della trave -- inserisco le lavorazioni non ribaltate della trave
for i = 1, #vProc do for i = 1, #vProc do
-- creo la lavorazione -- creo la lavorazione
local Proc = vProc[i] local Proc = vProc[i]
if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD) then if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD or BD.TURN) then
local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw) local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
if not bOk then if not bOk then
nTotErr = nTotErr + 1 nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1322,7 +1612,9 @@ function BeamExec.ProcessFeatures()
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
end end
-- se era taglio di separazione, aggiungo nuova fase -- se era taglio di separazione, aggiungo nuova fase
if bNewPhase then if nNewPhase > 0 then
nPhase = nNewPhase
elseif nNewPhase == 0 then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET) BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
-- se grezzo successivo senza pezzi e finale, va tolto -- se grezzo successivo senza pezzi e finale, va tolto
local nNextRawId = EgtGetNextRawPart( nRawId) local nNextRawId = EgtGetNextRawPart( nRawId)
+145 -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 -- Libreria globale per Travi
-- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto. -- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto.
-- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm. -- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm.
@@ -9,6 +9,13 @@
-- 2021/07/15 Aggiunta GetFaceElevationFromPointDir. -- 2021/07/15 Aggiunta GetFaceElevationFromPointDir.
-- 2021/09/12 Aggiustamenti in GetNearestParalOpposite e GetNearestOrthoOpposite. -- 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/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
-- Tabella per definizione modulo -- Tabella per definizione modulo
local BeamLib = {} local BeamLib = {}
@@ -186,40 +193,42 @@ function BeamLib.PutStartOnLonger( nCrvId)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, bDown) function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, bDown)
-- verifico che la curva sia chiusa -- verifico che la curva sia chiusa
if not EgtCurveIsClosed( nCrvId) then return false end if not EgtCurveIsClosed( nCrvId) then return false end
-- recupero il versore normale al piano di lavoro o estrusione -- recupero il versore normale al piano di lavoro o estrusione
local vtN = EgtCurveExtrusion( nCrvId, GDB_ID.ROOT) local vtN = EgtCurveExtrusion( nCrvId, GDB_ID.ROOT)
-- coefficienti per riportare la distanza nel piano di lavoro -- coefficienti per riportare la distanza nel piano di lavoro
local dCoeffX = 1 / ( sqrt( 1 - vtN:getX() * vtN:getX())) local dCoeffY = 0
local dCoeffY = 1 / ( sqrt( 1 - vtN:getY() * vtN:getY())) if abs( vtN:getY()) < 0.999 then dCoeffY= 1 / ( sqrt( 1 - vtN:getY() * vtN:getY())) end
local dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ())) 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) -- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa)
local dUopt = 0 local dUopt = 0
local dDopt = GEO.INFINITO local dDopt = GEO.INFINITO
local dZopt = GEO.INFINITO
local dUi, dUf = EgtCurveDomain( nCrvId) local dUi, dUf = EgtCurveDomain( nCrvId)
for dU = dUi, dUf, 0.5 do for dU = dUi, dUf, 0.5 do
local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT) local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT)
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 vtMin = ptP - b3Raw:getMin()
local vtMax = ptP - b3Raw:getMax() local vtMax = ptP - b3Raw:getMax()
local dD = abs( vtMin:getX()) * dCoeffX local dD = abs( vtMin:getY()) * dCoeffY
dD = min( abs( vtMax:getX()) * dCoeffX, dD)
dD = min( abs( vtMin:getY()) * dCoeffY, dD)
dD = min( abs( vtMax:getY()) * dCoeffY, dD) dD = min( abs( vtMax:getY()) * dCoeffY, dD)
if bDown then dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD) dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
else local dZ = abs( EgtIf( bDown, vtMin:getZ(), vtMax:getZ())) * dCoeffZ
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD) if dD < dMaxDist and dZ < dZopt + GEO.EPS_SMALL then
end
if dD < dDopt + GEO.EPS_SMALL then
dDopt = dD
dUopt = dU dUopt = dU
dDopt = dD
dZopt = dZ
end end
end 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) EgtChangeClosedCurveStart( nCrvId, dUopt)
end end
return true return true
@@ -264,8 +273,8 @@ function BeamLib.GetNearestParalOpposite( vtRef, vtNorm)
vtMyRef:normalize() vtMyRef:normalize()
end end
-- se prevalente una componente orizzontale (con piccolissimo vantaggio) -- 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()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then
if abs( vtMyRef:getX()) > abs( vtMyRef:getY()) - GEO.EPS_SMALL then if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then
if vtMyRef:getX() > -GEO.EPS_SMALL then if vtMyRef:getX() > -GEO.EPS_SMALL then
return MCH_MILL_FU.PARAL_LEFT return MCH_MILL_FU.PARAL_LEFT
else else
@@ -298,9 +307,9 @@ function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm)
vtMyRef:normalize() vtMyRef:normalize()
end end
-- se prevalente una componente orizzontale (con piccolissimo vantaggio) -- 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()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then
-- se prevale la componente destra/sinistra (con piccolo vantaggio) -- se prevale la componente destra/sinistra
if abs( vtMyRef:getX()) > 0.9 * abs( vtMyRef:getY()) then if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then
if vtMyRef:getX() > -GEO.EPS_SMALL then if vtMyRef:getX() > -GEO.EPS_SMALL then
return MCH_MILL_FU.ORTHO_LEFT return MCH_MILL_FU.ORTHO_LEFT
else else
@@ -362,17 +371,17 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function BeamLib.GetVersRef( nOrthoOpposite) 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() 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() 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() 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() 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() 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() return -Z_AX()
end end
return nil return nil
@@ -403,7 +412,7 @@ function BeamLib.GetBoxFaceNorm( b3Box, ptP, vtV)
local dNzDotV = vtNz * vtV local dNzDotV = vtNz * vtV
if dNxDotV > dNyDotV and dNxDotV > dNzDotV then if dNxDotV > dNyDotV and dNxDotV > dNzDotV then
return vtNx return vtNx
elseif dNyDotV > dNzDotV and dNyDotV > dNxDotV then elseif dNyDotV > dNzDotV then
return vtNy return vtNy
else else
return vtNz return vtNz
@@ -644,7 +653,7 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function BeamLib.GetFaceHvRefDim( nSurfId, nFacet) function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw)
-- recupero centro e normale della faccia -- recupero centro e normale della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
if not ptC or not vtN then return end if not ptC or not vtN then return end
@@ -655,8 +664,21 @@ function BeamLib.GetFaceHvRefDim( nSurfId, nFacet)
end end
-- determino l'ingombro in questo riferimento -- determino l'ingombro in questo riferimento
local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV) 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 -- restituisco i valori calcolati
return frHV, b3HV:getDimX(), b3HV:getDimY() return frHV, dDimH, dDimV
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
@@ -679,15 +701,51 @@ function BeamLib.UpdateTCING( nRawId, dTCI)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamLib.GetNzLimDownUp( b3Raw, bFromTop) function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
if not BD.C_SIMM then if BD.C_SIMM or BD.TURN 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
return -0.484 return -0.484
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
end end
@@ -708,5 +766,53 @@ function BeamLib.GetPhaseType( nPhase)
return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '') return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '')
end end
---------------------------------------------------------------------
function BeamLib.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
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
return BeamLib return BeamLib
+8 -2
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 -- Gestione dei piano paralleli nei tagli lunghi: equidistanziamento dei piani paralleli
-- Tabella per definizione modulo -- Tabella per definizione modulo
@@ -474,7 +474,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 if vtNInner:getZ() > -0.0175 or vtNInner:getZ() < dNzLimDwnUp or abs( vtNInner:getY()) > 0.8 then
vtO:rotate( vtNInner, 90) vtO:rotate( vtNInner, 90)
-- se diretto troppo ortogonalmente all'asse trave e taglio non da sotto, lo ruoto ulteriormente -- 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) vtO:rotate( vtNInner, 90)
-- se faccia principale verso il basso (almeno -3deg), lo inverto per iniziare da sopra -- se faccia principale verso il basso (almeno -3deg), lo inverto per iniziare da sopra
if vtNInner:getZ() < -0.05 then if vtNInner:getZ() < -0.05 then
@@ -550,6 +550,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 -- Se esiste la superficie limitante (nFacet == 2) verifica se il taglio più esterno è superfluo e quindi viene eliminato
if not bGetOrtoPlanes then if not bGetOrtoPlanes then
VerifyFirstOrthoCut( UltimateTable, originalOffsetP, BBoxRawPart, dNzLimDwnUp) 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 end
return UltimateTable 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
+150 -58
View File
@@ -1,4 +1,4 @@
-- FacesBySaw.lua by Egaltech s.r.l. 2021/11/26 -- FacesBySaw.lua by Egaltech s.r.l. 2022/06/29
-- Gestione taglio con lama di feature con una o due facce -- 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/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. -- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg.
@@ -10,6 +10,8 @@
-- 2021/08/03 In MakeOneFaceBySaw mgliorata gestione tagli con normale verso il basso e da sopra. -- 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/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. -- 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.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local FacesBySaw = {} local FacesBySaw = {}
@@ -39,6 +41,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
nOrthoOpposite = Par5 nOrthoOpposite = Par5
vtOrthO = BL.GetVersRef( Par5) vtOrthO = BL.GetVersRef( Par5)
end 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) -- 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) 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 if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then
@@ -83,8 +87,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
end end
end end
-- verifico se lavorazione con lama sotto e testa sopra -- 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, vtN, vtOrthO) end
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, bFromTop) end
local bDownUp = ( vtN:getZ() < dVzLimDwnUp) local bDownUp = ( vtN:getZ() < dVzLimDwnUp)
local nFaceUse = nOrthoOpposite local nFaceUse = nOrthoOpposite
if bDownUp then nFaceUse = BL.GetOrtupOpposite( nOrthoOpposite) end if bDownUp then nFaceUse = BL.GetOrtupOpposite( nOrthoOpposite) end
@@ -127,30 +130,39 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
local dLenLi2 = abs( dLi2Tang) local dLenLi2 = abs( dLi2Tang)
local dLenLo2 = abs( dLo2Tang) local dLenLo2 = abs( dLo2Tang)
-- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale) -- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale)
local bTurnTang
local Ktp = 1.1 local Ktp = 1.1
if BD.KIOTP then Ktp = BD.KIOTP end if BD.KIOTP then Ktp = BD.KIOTP end
if ( not bDownUp or abs( vtTg:getY()) > 0.5) and abs( vtTg:getX()) < 0.9848 and if ( not bDownUp or abs( vtTg:getY()) > 0.5) and
( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5)) or ( 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 ( 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 ( Ktp * dLenLi2 < dLenLi and Ktp * dLenLo2 < dLenLo) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) then
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp 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 end
-- posizione braccio -- posizione braccio
EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3) EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3)
local nSCC = MCH_SCC.NONE 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 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) nSCC = EgtIf( ( vtAux:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
else else
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end end
--end else
-- per macchine PF se possibile preferisco tenere la testa più davanti local vtTest = EgtIf( bTurnTang, EgtIf( bInvert, vtTg, -vtTg), vtOut)
--if BD.C_SIMM and abs( vtTg:getZ()) < 0.01 and abs( vtTg:getX()) < 0.5 then if abs( vtTest:getY()) > abs( vtTest:getZ()) then
-- if nSCC == MCH_SCC.ADIR_YP then nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
-- nSCC = MCH_SCC.ADIR_YM else
-- end nSCC = EgtIf( vtTest:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
--end end
end
-- inserisco la lavorazione di taglio -- inserisco la lavorazione di taglio
local sName = 'Cut_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_' .. tostring( nFacet + 1) local sName = 'Cut_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_' .. tostring( nFacet + 1)
local nMchFId = EgtAddMachining( sName, sCutting) local nMchFId = EgtAddMachining( sName, sCutting)
@@ -176,6 +188,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
-- imposto attacco/uscita -- imposto attacco/uscita
EgtSetMachiningParam( MCH_MP.LITANG, dLiTang) EgtSetMachiningParam( MCH_MP.LITANG, dLiTang)
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp) 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.LOTANG, dLoTang)
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp) EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
-- imposto allungamenti iniziale e finale -- imposto allungamenti iniziale e finale
@@ -184,7 +197,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
-- eventuali note -- eventuali note
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -217,15 +230,6 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
local vtN = {} local vtN = {}
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, 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 -- recupero dati su giunzione tra facce
local bTouch, ptT1, ptT2, dAngT = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) local bTouch, ptT1, ptT2, dAngT = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
if not bTouch then if not bTouch then
@@ -233,44 +237,64 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end 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 -- calcolo direzione di lavoro
local vtRef = {} local vtRef = {}
local vtTg = ptT2 - ptT1 ;
vtRef[1] = vtN[1] ^ vtTg vtRef[1] = vtN[1] ^ vtTg
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
vtRef[1]:normalize() 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 vtRef[2] = vtN[2] ^ vtTg
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end
vtRef[2]:normalize() 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 -- determino quale faccia è più grande
local ptPs = ( ptT1 + ptT2) / 2 local dSqDim1 = ( ptC[1] - ptM):sqlen()
local dSqDim1 = ( ptC[1] - ptPs):sqlen() local dSqDim2 = ( ptC[2] - ptM):sqlen()
local dSqDim2 = ( ptC[2] - ptPs):sqlen()
local nBigInd = EgtIf( dSqDim1 > dSqDim2 - 1., 1, 2) local nBigInd = EgtIf( dSqDim1 > dSqDim2 - 1., 1, 2)
local nSmaInd = 3 - nBigInd local nSmaInd = 3 - nBigInd
local nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2) local nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2)
local nOtInd = 3 - nUpInd local nOtInd = 3 - nUpInd
-- metto in relazione la scelta facce con il confronto del versore Z con la scelta in base alla grandezza faccia -- 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 -- se la faccia più grande è messa secondaria e il suo versore Z non è troppo negativo
if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -5 * GEO.EPS_SMALL and vtN[nSmaInd]:getZ() < 0.866 then if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -0.5 and vtN[nSmaInd]:getZ() < 0.966 then
nOtInd = nSmaInd
nUpInd = nBigInd nUpInd = nBigInd
nOtInd = nSmaInd
end end
-- recupero la lavorazione -- recupero la lavorazione
local sCutting = ML.FindCutting( sCutType) local sCutting = ML.FindCutting( sCutType, nil, bDownHead)
if not sCutting then if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library' local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- recupero i dati dell'utensile -- recupero i dati dell'utensile
local dSawDiam = 400 local dSawDiam = 400
local dSawThick = 5 local dSawThick = 5
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
-- calcolo extra taglio -- calcolo extra taglio
@@ -283,45 +307,113 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
if bDownHead then if bDownHead then
dNzLimDwnUp = - 2 dNzLimDwnUp = - 2
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
-- verifico se necessari tagli supplementari -- 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) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then if #vCuts > 0 then
-- recupero gruppo per geometria addizionale -- sistemo posizione nel DB, nome e info
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 i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
end end
-- eseguo -- con testa da sopra
for i = 1, #vCuts do if not bDownHead or BD.TURN then
-- assegno il modo di tagliare -- eseguo
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nOtInd], vtRef[nUpInd]) for i = 1, #vCuts do
-- lavoro la faccia -- assegno il modo di tagliare
for j = 1, #vCuts[i] do local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nOtInd], vtRef[nUpInd])
-- se FAST, pezzo alto e ultimo taglio verticale -> allungo uscita per consentire eventuale rotazione B sul posto -- lavoro la faccia
local dAccEnd = 0 for j = 1, #vCuts[i] do
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 -- se FAST, pezzo alto e ultimo taglio verticale -> allungo uscita per consentire eventuale rotazione B sul posto
dAccEnd = - ( dSawDiam / 2 + BD.CUT_SIC) 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 end
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, dAccEnd, nil, b3Raw) end
if not bOk then -- altrimenti con testa da sotto
return bOk, sErr 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 end
end end
else 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 -- se prima faccia lavorata è da sotto scambio le facce
if vtN[nOtInd]:getZ() < -0.5 then if vtN[nOtInd]:getZ() < -0.5 then
nUpInd, nOtInd = nOtInd, nUpInd nUpInd, nOtInd = nOtInd, nUpInd
@@ -543,4 +635,4 @@ function FacesBySaw.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dRad, vtRef, dCutExt
return dLiTang, dLiPerp, dLoTang, dLoPerp return dLiTang, dLiPerp, dLoTang, dLoPerp
end end
return FacesBySaw return FacesBySaw
+346 -82
View File
@@ -1,5 +1,7 @@
-- 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 -- 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
-- Tabella per definizione modulo -- Tabella per definizione modulo
local MachiningLib = {} local MachiningLib = {}
@@ -17,6 +19,83 @@ local Pocketings = require( 'PocketingData')
local Sawings = require( 'SawingData') local Sawings = require( 'SawingData')
local Drillings = require( 'DrillData') 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) local function SetCurrMachiningAndTool( sMachName)
if not EgtMdbSetCurrMachining( sMachName) then return false end if not EgtMdbSetCurrMachining( sMachName) then return false end
@@ -24,106 +103,291 @@ local function SetCurrMachiningAndTool( sMachName)
local sTool = EgtTdbGetToolFromUUID( sTuuid) local sTool = EgtTdbGetToolFromUUID( sTuuid)
if not sTool then return false end if not sTool then return false end
if not EgtTdbSetCurrTool( 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 end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindCutting( sType) function VerifyDrill( dDiam, dDepth, bH2)
for i = 1, #Cuttings do local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local Cutting = Cuttings[i] local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
if Cutting.On and Cutting.Type == sType and SetCurrMachiningAndTool( Cutting.Name) then local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
return Cutting.Name local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
end 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
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen) function VerifyDrillPocket( dDiam, dDepth, bH2)
for i = 1, #Millings do local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local Milling = Millings[i] local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID) local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() local dDiamTh = EgtTdbGetCurrToolThDiam()
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) local dFreeLen = dTMaxDepth
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) if dTDiam < dDiam - 10 * GEO.EPS_SMALL and
if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) then
( not sTuuidMstr or sTuuidMstr == sTuuid) and return true, { TMaxDepth = dTMaxDepth, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2}
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and end
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then end
return Milling.Name, dTMaxDepth, dTDiam
---------------------------------------------------------------------
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
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
SetNextMachining( sToolName, nActiveHead, bFixed)
return ReturnParams( MachiningType, Machining.Name, Machining.Type, ToolParams)
else
-- 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
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
end end
end if MachineHeadUse == TWO_EQUAL_HEADS then
-- verifico se cambiare testa o cambiare utensile su quella corrente
--------------------------------------------------------------------- if nActiveHead == 1 then
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen) if sH2Mach ~= "" then
for i = 1, #Pocketings do SetNextMachining( sH2Tool, 2, bFixed)
local Pocketing = Pocketings[i] return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then --return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) elseif sH1Mach ~= "" then
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth() SetNextMachining( sH1Tool, 1, bFixed)
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and --return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and end
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then elseif nActiveHead == 2 then
return Pocketing.Name, dTDiam, dTMaxDepth 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 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 end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindSawing( sType) function MachiningLib.FindSawing( sType)
for i = 1, #Sawings do return FindMachining( MCH_MY.MORTISING, sType)
local Sawing = Sawings[i]
if Sawing.On and Sawing.Type == sType and SetCurrMachiningAndTool( Sawing.Name) then
return Sawing.Name
end
end
end end
--------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function MachiningLib.FindDrilling( dDiam, dDepth, bDown) function MachiningLib.ApplyMachining( bRecalc, bApplyPost)
-- ricerca sulle forature, dal diametro maggiore al minore local bResult = EgtApplyMachining( bRecalc, bApplyPost)
local sDrType = 'Drill' .. EgtIf( bDown, '_H2', '') if bResult then ConfirmNextMachining() end
for i = #Drillings, 1, -1 do return bResult
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
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
+10 -7
View File
@@ -1,5 +1,6 @@
-- ProcessBlockHausFront.lua by Egaltech s.r.l. 2020/08/03 -- ProcessBlockHausFront.lua by Egaltech s.r.l. 2020/08/03
-- Gestione calcolo giunzione block house in testa -- 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 -- Tabella per definizione modulo
local ProcessBlockHausFront = {} local ProcessBlockHausFront = {}
@@ -43,7 +44,10 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- 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 -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -125,7 +129,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId) local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup' local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -141,7 +145,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- 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 bCut = false
end end
-- se va fatto, inserisco la lavorazione -- 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 -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {} local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then 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 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 end
if #vCuts > 0 then if #vCuts > 0 then
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
@@ -233,7 +236,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- 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 bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
+2 -2
View File
@@ -75,7 +75,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -178,7 +178,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, 0}}) EgtSetMachiningGeometry( {{ Proc.Id, 0}})
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
+150 -122
View File
@@ -1,4 +1,4 @@
-- ProcessCut.lua by Egaltech s.r.l. 2022/01/26 -- ProcessCut.lua by Egaltech s.r.l. 2022/07/28
-- Gestione calcolo singoli tagli di lama per Travi -- Gestione calcolo singoli tagli di lama per Travi
-- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito. -- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito.
-- 2021/06/06 Correzioni per tagli con testa da sotto. -- 2021/06/06 Correzioni per tagli con testa da sotto.
@@ -6,6 +6,15 @@
-- 2021/09/19 Tagli da sotto non sbiechi favorita posizione da sopra di testa. -- 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. -- 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/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.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessCut = {} local ProcessCut = {}
@@ -32,26 +41,28 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function ProcessCut.Classify( Proc, b3Raw) function ProcessCut.Classify( Proc, b3Raw)
-- se PF con testa da sotto, ammessa qualunque orientazione -- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true return true
end end
-- recupero i dati del taglio -- recupero i dati del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) 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 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) -- calcolo le massime estensioni lineari orizzontale e verticale della faccia
if DimH > BD.MAX_DIM_DICE then 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 return true, true
end end
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 dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then if bDownCut then
-- calcolo l'ingombro orizzontale della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0) local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
-- confronto anche qua la distanza maggiore della faccia con la massima distanza del DiceCut -- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli)
-- e se il rapporto supera il 2 (implica che genera 3 tagli) dichiaro impossibile la lavorazione if DimH > 2 * BD.MAX_DIM_DICE then
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
return true, true return true, true
end end
end end
@@ -156,7 +167,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -179,7 +190,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -192,7 +203,7 @@ end
local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw) local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
-- eventuale segnalazione ingombro di testa o coda (se non chiamata da altre feature) -- 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()) 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 if Proc.Head then
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
if vtN:getZ() > 0.5 then if vtN:getZ() > 0.5 then
@@ -219,33 +230,35 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione con testa da sopra -- 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 -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) b3Raw = b3Raw or EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box') local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
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
-- dati geometrici del taglio -- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- limiti di taglio (se molto di lato e inclinati sono permessi fino a -45deg) -- limiti di taglio (se molto di lato e inclinati sono permessi fino a -45deg)
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw) local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
if not BD.C_SIMM and abs( vtN:getX()) < 0.5 then dNzLimDwnUp = -0.707 end
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bFromBottom == nil then 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 end
-- verifico se da considerare taglio lungo ( non da sotto, inclinato non più di 30deg, largo come la trave e abbastanza lungo) -- 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 local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and
Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000)) ( 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 ( vtN:getY() > 0.865 or 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 -- se taglio lungo e Q04 = 1 allora lancio il processo dell'L10
if bLongCut and EgtGetInfo( Proc.Id, 'Q04', 'i') == 1 then local bNoDicing = EgtGetInfo( Proc.Id, 'Q04', 'i') == 1
return LongCut.Make( Proc, nPhase, nRawId, nPartId, true) if bNoDicing then
if bLongCut then
return LongCut.Make( Proc, nPhase, nRawId, nPartId, true)
elseif bLongCutFromSide then
return LongCut.Make( Proc, nPhase, nRawId, nPartId, false, 2)
end
end end
-- se pezzo ancora attaccato alla trave, per non rovinare quello successivo -- se pezzo ancora attaccato alla trave, per non rovinare quello successivo
local bFillAreaPiece local bFillAreaPiece
@@ -293,7 +306,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
end end
-- se vero taglio, eventuale inserimento smussi -- 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) local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end if not bOkc then return bOkc, sErrC end
end end
@@ -311,13 +324,21 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- determino la direzione di taglio preferenziale -- determino la direzione di taglio preferenziale
local _, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0) local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA and not bDownCut) 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) 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 -- verifico se necessari tagli supplementari
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3) EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
local vCuts = {} 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 ptExtra, vtExtra
local bAutoCalcSurf = true local bAutoCalcSurf = true
if bFillAreaPiece or bFillTail then if bFillAreaPiece or bFillTail then
@@ -326,10 +347,13 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
vtExtra = X_AX() vtExtra = X_AX()
bAutoCalcSurf = false bAutoCalcSurf = false
end end
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA) -- se il taglio è più spesso della lama abilito il dicing, altrimenti no
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate if Proc.Box:getDimX() >= dSawThick then
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY()) -- 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
end end
-- se il ProcessCut viene lanciato dal ProcessSawCut e non ci sono tagli a cubetti, esco -- se il ProcessCut viene lanciato dal ProcessSawCut e non ci sono tagli a cubetti, esco
@@ -338,18 +362,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
--DC.PrintOrderCut( vCuts) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then 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 e nome
local bOrthInv = false local bOrthInv = false
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
if ( i % 2) == 1 then if ( i % 2) == 1 then
@@ -393,14 +409,12 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
else else
if bHorizCut then if bHorizCut then
vtOrthoO = Z_AX() vtOrthoO = Z_AX()
elseif vtN:getY() > -0.02 then
if not Proc.Head then
vtOrthoO = -Y_AX()
else
vtOrthoO = Y_AX()
end
else 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 end
end end
@@ -418,9 +432,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
if not BD.C_SIMM and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.707 end if not BD.C_SIMM and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.707 end
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) 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 if not bOk then return bOk, sErr end
return bOk, sErr
end
end end
-- tutti gli altri casi vengono saltati -- tutti gli altri casi vengono saltati
-- caso generale -- caso generale
@@ -442,46 +454,55 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end end
local dVzLimDwnUp = dNzLimDwnUp local dVzLimDwnUp = dNzLimDwnUp
if not BD.C_SIMM and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end 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) 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 if not bOk then return bOk, sErr end
return bOk, sErr
end
end end
end end
end end
-- altrimenti tagli diretti della faccia -- altrimenti tagli diretti della faccia
else 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 -- lavoro la faccia
local vtOrthoO local vtOrthoO
if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
vtOrthoO = -Z_AX() 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() 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 if Proc.Head then
vtOrthoO = X_AX() vtOrthoO = X_AX()
else else
vtOrthoO = -X_AX() vtOrthoO = -X_AX()
end 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 if Proc.Head then
vtOrthoO = X_AX() vtOrthoO = X_AX()
else else
vtOrthoO = -X_AX() vtOrthoO = -X_AX()
end end
elseif Proc.Head then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
else else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX()) 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 end
-- taglio -- taglio
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dNzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) 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 if not bOk then return bOk, sErr end
return bOk, sErr
end
end end
-- Aggiornamento ingombro
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
return true return true
end end
@@ -491,17 +512,11 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box') local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
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
-- dati geometrici del taglio -- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- se vero taglio, eventuale inserimento smussi -- 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) local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end if not bOkc then return bOkc, sErrC end
end end
@@ -519,12 +534,19 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
local dMaxVertDepth = dMaxDepth local dMaxVertDepth = dMaxDepth
-- determino la direzione di taglio preferenziale -- determino la direzione di taglio preferenziale
local _, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0) local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA) 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 -- verifico se necessari tagli supplementari
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3) EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
local vCuts = {} 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 ptExtra, vtExtra
local bAutoCalcSurf = true local bAutoCalcSurf = true
if bFillAreaPiece or bFillTail then if bFillAreaPiece or bFillTail then
@@ -533,22 +555,14 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
vtExtra = X_AX() vtExtra = X_AX()
bAutoCalcSurf = false bAutoCalcSurf = false
end 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 end
--DC.PrintOrderCut( vCuts) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then 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 e nome
local bOrthInv = false local bOrthInv = false
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
if ( i % 2) == 1 then if ( i % 2) == 1 then
@@ -627,9 +641,7 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire) -- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
if vCuts[i+1][j] then 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) 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 if not bOk then return bOk, sErr end
return bOk, sErr
end
end end
end end
end end
@@ -637,9 +649,9 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
else else
-- lavoro la faccia -- lavoro la faccia
local vtOrthoO 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() 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 if Proc.Head then
vtOrthoO = X_AX() vtOrthoO = X_AX()
else else
@@ -665,63 +677,79 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
end end
-- taglio (limite Vz Down Up messo a -2 per non farlo mai intervenire) -- 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) local dCutExtra = BD.CUT_EXTRA
if not bOk then if Proc.AdvTail then
return bOk, sErr dCutExtra = min( -BD.ADVANCE_TAIL_OFFS, dMaxVertDepth - dCutV)
end 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 end
-- Aggiornamento ingombro
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
return true return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- 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 -- 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 -- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- se taglio di testa -- se taglio di testa
if Proc.Head then if not bForced then
-- se coincide con il taglio di separazione precedente, non va fatto if Proc.Head then
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL 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
-- se coincide con un taglio frontale non va fatto
if Proc.CutFront then
return true 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
return true
end
end
-- se coincide con un taglio frontale non va fatto
if Proc.CutFront then
return true
end end
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione larga o pezzo corto) -- 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)
local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and 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_HTCUT - 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 -- recupero la lavorazione
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide') local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', '')) local sCutting
if not sCutting and bTopHead then sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead)
sCutting = ML.FindCutting( sCutType)
bDownHead = false
end
if not sCutting then if not sCutting then
local sErr = 'Error : cutting not found in library' local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- se taglio con testa da sopra -- se taglio con testa da sopra
if not bDownHead then if not bDownHead and not bDownTurn then
return MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut) local bOk, sErr = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
if not bOk then return false, sErr end
-- altrimenti taglio con testa da sotto -- altrimenti taglio con testa da sotto
else 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 end
-- Aggiornamento ingombro (se vero taglio o richiesto)
if ProcessCut.Identify( Proc) or bUpdateIng then
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
end
return true
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+1 -1
View File
@@ -69,7 +69,7 @@ function ProcessDecor.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
+52 -88
View File
@@ -1,4 +1,4 @@
-- 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 -- Gestione calcolo doppi tagli di lama per Travi
-- Tabella per definizione modulo -- Tabella per definizione modulo
@@ -28,54 +28,70 @@ end
function ProcessDoubleCut.Classify( Proc, b3Raw) function ProcessDoubleCut.Classify( Proc, b3Raw)
--se una faccia, uso la classificazione dei tagli singoli --se una faccia, uso la classificazione dei tagli singoli
if Proc.Fct == 1 then return Cut.Classify( Proc, b3Raw) end if Proc.Fct == 1 then return Cut.Classify( Proc, b3Raw) end
-- se PF con testa da sotto, ammessa qualunque orientazione -- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true return true
end end
-- limite per facce da sotto -- determino se convesso o concavo
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
-- verifico se convesso
local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT) local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
local bConvex = ( not bAdj or ( dAng > 0)) local bConvex = ( not bAdj or ( dAng > 0))
-- se convesso
if bConvex then if bConvex then
-- recupero i dati di ogni singola faccia -- recupero i dati di ogni singola faccia
for i = 1, 2 do for i = 1, 2 do
local nFac = i - 1 local nFac = i - 1
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFac, GDB_ID.ROOT) 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 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) -- calcolo la massima estensione orizzontale lineare della faccia
if DimH > BD.MAX_DIM_DICE then 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 return true, true
end end
end end
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then if bDownCut then
-- calcolo l'ingombro orizzontale della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac) local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac)
-- confronto anche qua la distanza maggiore della faccia con la massima distanza del DiceCut -- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli)
-- e se il rapporto supera il 2 (implica che genera 3 tagli) dichiaro impossibile la lavorazione if DimH > 2 * BD.MAX_DIM_DICE then
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
return true, true return true, true
end end
end end
end end
return true, false return true, false
end
-- altrimenti concavo, verifico le normali delle facce per tagli da sotto -- altrimenti concavo, verifico le normali delle facce per tagli da sotto
for i = 1, 2 do else
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT) local ptC = {}
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) local vtN = {}
if bDownCut then ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- dimensione della faccia perpendicolare alla linea di intersezione tra le facce ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, 2-i, GDB_ID.ROOT) local vtX = vtN[1] ^ vtN[2] ; vtX:normalize()
local vtX = vtN2 ^ vtN local vtY = { vtX ^ vtN[1], - vtX ^ vtN[2]}
local frRef = Frame3d( ptC, ptC + 100 * vtX, ptC + 100 * vtN2) for i = 1, 2 do
local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, i-1, GDB_BB.STANDARD, frRef) local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN[i], vtY[i])
if b3Ref:getDimY() > BD.MAX_DIM_DICE then local bDownCut = ( vtN[i]:getZ() <= dNzLimDwnUp)
return true, true 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
end end
return true, false
end end
return true, false
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -119,7 +135,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end 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 if bVert and not sMillingDw then
local sErr = 'Error : milling (Mark_H2) not found in library' local sErr = 'Error : milling (Mark_H2) not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -141,7 +157,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -164,7 +180,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -176,7 +192,7 @@ end
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se singola faccia, passo a quella lavorazione -- 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 -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -235,9 +251,9 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD) local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
-- applico lavorazione -- 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} 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 if not bOk then return bOk, sErr end
end end
-- creo piano di taglio coincidente con la seconda faccia e lo lavoro -- creo piano di taglio coincidente con la seconda faccia e lo lavoro
@@ -247,70 +263,18 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD) local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
-- applico lavorazione -- 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} 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 if not bOk then return bOk, sErr end
end end
-- altrimenti concavo -- altrimenti concavo
else else
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -30deg) -- eseguo
local bTopHead = ( BD.DOWN_HEAD and vtNm:getZ() > -0.5)
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < -0.5)
-- recupero la lavorazione
local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide') local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide')
local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', '')) local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < BD.NZ_MINB)
if not sCutting and bTopHead then local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead)
sCutting = ML.FindCutting( sCutType) if not bOk then return bOk, sErr end
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
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)
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
return bOk, sErr
end
end
-- segnalazione ingombro di testa o coda -- segnalazione ingombro di testa o coda
if Proc.Head then if Proc.Head then
-- intersezioni con linee a metà altezza appena dentro dal davanti e dal dietro -- 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 -- ProcessDovetail.lua by Egaltech s.r.l. 2021/02/04
-- Gestione calcolo giunzione coda di rondine -- 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 -- Tabella per definizione modulo
local ProcessDovetail = {} local ProcessDovetail = {}
@@ -226,7 +227,7 @@ local function AddFaceToSurf( Proc, nPartId, b3Solid)
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId) local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup' local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -592,7 +593,7 @@ local function MachChainFacesByBlade( Proc, nCFaceSide, nCFaceInt1, nCFaceInt2,
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 50) EgtSetMachiningParam( MCH_MP.STARTADDLEN, 50)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 50) EgtSetMachiningParam( MCH_MP.ENDADDLEN, 50)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -656,7 +657,7 @@ local function MakeByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3So
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId) local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup' local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -836,7 +837,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling,
end end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -1221,7 +1222,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
local nSCC = MCH_SCC.ADIR_YP local nSCC = MCH_SCC.ADIR_YP
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -1380,7 +1381,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
end 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 -- recupero la geometria ausiliaria
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') 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 -- recupero il centro e la normale della faccia ausiliaria
local ptC, vtN = EgtSurfTmFacetCenter( AuxId, 0, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( AuxId, 0, GDB_ID.ROOT)
if not vtN then 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) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1398,7 +1399,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
-- recupero la lavorazione per la geometria ausiliaria -- recupero la lavorazione per la geometria ausiliaria
local sCutting = ML.FindCutting( 'HeadSide') local sCutting = ML.FindCutting( 'HeadSide')
if not sCutting then 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) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1415,7 +1416,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId) local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup' local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1427,7 +1428,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
return true return true
end end
-- verifico se coincide con taglio di coda -- 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 return true
end end
-- inserisco la lavorazione -- inserisco la lavorazione
@@ -1710,7 +1711,9 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- 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 -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- in base al tipo di feature attribuisco il significato dei parametri Q -- 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) -- se ha due facce ( allora è di testa o coda)
if Proc.Fct == 2 then if Proc.Fct == 2 then
-- eventuale taglio di testa o coda -- 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 if not bAuxOk then return bAuxOk, sAuxErr end
-- lavorazione della feature -- lavorazione della feature
local bOk, sErr = Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, bForceUseRough) 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 -- se ha 3 facce ed è di testa o coda
elseif Proc.Fct == 3 and ( Proc.Head or Proc.Tail) then elseif Proc.Fct == 3 and ( Proc.Head or Proc.Tail) then
-- eventuale taglio di testa o coda -- 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 if not bAuxOk then return bAuxOk, sAuxErr end
-- lavorazione della feature -- lavorazione della feature
if bForceUseRough then if bForceUseRough then
+155 -100
View File
@@ -1,9 +1,18 @@
-- 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 -- Gestione calcolo forature per Travi
-- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile. -- 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/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/09/19 DS Si premia il più possibile ricerca punta con adeguato affondamento.
-- 2021/10/29 DS MaxElev anche su fori con svuotatura. -- 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.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDrill = {} local ProcessDrill = {}
@@ -52,9 +61,11 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Verifica se feature di coda -- 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 -- 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 return false
end end
-- recupero e verifico l'entità foro -- recupero e verifico l'entità foro
@@ -65,8 +76,8 @@ function ProcessDrill.IsTailFeature( Proc, b3Raw)
end end
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
-- se entrata principale -- 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) return ( ( nFcs == 5 or nFcs == 6) and vtExtr:getX() < -0.5)
-- altrimenti entrata opposta -- altrimenti entrata opposta
else else
@@ -117,7 +128,7 @@ function ProcessDrill.Split( Proc, b3Raw)
local bHoriz = ( abs( vtExtr:getZ()) < abs( BD.DRILL_VZ_MIN) and 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)) ( 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) 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 end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -146,22 +157,56 @@ function ProcessDrill.Classify( Proc, b3Raw)
return false, false, false return false, false, false
end end
local bOpen = ( Proc.Fce ~= 0) 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 -- 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 (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then
if not bOpen then if not bOpen then
return true, true, false return true, true, false
else 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 end
else else
return true, false, false return true, false, false
end end
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 -- Applicazione della lavorazione
function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) 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 -- ingombro del pezzo
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then if not b3Solid then
@@ -180,19 +225,34 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- recupero i dati del foro -- recupero i dati del foro
local dDiam = 2 * EgtArcRadius( AuxId) local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId)) local dLen = abs( EgtCurveThickness( AuxId))
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
local vtExtr = EgtCurveExtrusion( 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) 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 -- 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 if bToInvert and ( not bOpen or Proc.Flg ~= 1) then
local sErr = 'Error : drilling from bottom impossible' local sErr = 'Error : drilling from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- se il foro è cieco all'inizio, lo inverto -- se non già richiesta inversione e invertibile
if Proc.Fcs == 0 then bToInvert = true end if not bToInvert and Proc.Flg == 1 and ( -vtExtr:getZ() >= BD.DRILL_VZ_MIN or bDownDrill) then
if bToInvert then vtExtr = - vtExtr end -- 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 -- se foro è splittato ed è la parte opposta, inverto
if Proc.Flg == -2 then bToInvert = true end if Proc.Flg == -2 then bToInvert = true end
-- profondità geometrica del foro -- profondità geometrica del foro
@@ -205,20 +265,13 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
local dCheckDepth2 = dDepth2 local dCheckDepth2 = dDepth2
local nErrorCode = 0 local nErrorCode = 0
-- abilitazione foratura da sotto -- abilitazione foratura da sotto
local bDrillDown = ( BD.DOWN_HEAD and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259)) local bDrillDown = ( bDownDrill and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259))
local bDrillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259) local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.5)
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante -- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
-- recupero la lavorazione -- recupero la lavorazione
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillDown) local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
if not sDrilling and bDrillUp then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth)
end
if not sDrilling and dCheckDepth then if not sDrilling and dCheckDepth then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown) sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, 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)
if sDrilling then dCheckDepth = nil end if sDrilling then dCheckDepth = nil end
end end
if not sDrilling then if not sDrilling then
@@ -232,10 +285,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nErrorCode = 2 nErrorCode = 2
-- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto) -- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto)
else else
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown) sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
if not sDrilling and bDrillUp then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0)
end
if not sDrilling then if not sDrilling then
nErrorCode = 1 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 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 +297,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- recupero la lavorazione -- recupero la lavorazione
local sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 local sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2
if dDepth2 > dDepth + BD.DRILL_OVERLAP then if dDepth2 > dDepth + BD.DRILL_OVERLAP then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillDown) sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillUp, bDrillDown)
if not sDrilling2 and bDrillUp then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2)
end
if not sDrilling2 and dCheckDepth2 then if not sDrilling2 and dCheckDepth2 then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown) sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, 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)
if sDrilling2 then dCheckDepth2 = nil end if sDrilling2 then dCheckDepth2 = nil end
end end
if not sDrilling2 then if not sDrilling2 then
@@ -270,10 +313,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nErrorCode = 2 nErrorCode = 2
-- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto) -- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto)
else else
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown) sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
if not sDrilling2 and bDrillUp then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0)
end
if not sDrilling2 then if not sDrilling2 then
nErrorCode = 1 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 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 +328,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 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 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 bToInvert = true
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr vtExtr = - vtExtr
--------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -306,8 +347,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
dToolFreeLen = dToolFreeLen2 dToolFreeLen = dToolFreeLen2
dDepth = dDepth2 dDepth = dDepth2
if vtExtr:getY() > 0 then if vtExtr:getY() > 0 then
bToInvert = true bToInvert = true
vtExtr = - vtExtr ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
end end
-- se sono al secondo mezzo foro con utensile che supera la lunghezza di riferimento non lo eseguo -- 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 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 +364,64 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
local dSubL1 = 0 -- Determino la faccia di inizio del foro e dati correlati
local dSubL2 = 0 local nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
local dSubL3 = 0 -- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia
local dDeltaRad = ( Proc.Diam - dToolDiam) / 2 local TgA = CosB / sqrt( 1 - CosB * CosB)
-- se foro non su testa o coda e inclinato, limito il massimo affondamento local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 2) * TgA
local bInMid = false local dMaxDepthOri = dMaxDepth
local bInvertFcse = ( bToInvert and Proc.Flg ~= -2) dMaxDepth = min( dMaxDepth, dToolFreeLen - dSubL)
if ( not bInvertFcse and Proc.Fcs ~= 5 and Proc.Fcs ~= 6) or ( bInvertFcse and Proc.Fce ~= 5 and Proc.Fce ~= 6) then -- Verifico inclinazione foro nei limiti
bInMid = true local bTryDrill = ( CosB < BD.DRILL_VX_MAX)
local CosB = abs( vtExtr:getX()) if ( CosB > 0.8 * BD.DRILL_VX_MAX and CosB < BD.DRILL_VX_MAX_ANGLEDRILL) then
if CosB < BD.DRILL_VX_MAX then -- cerco le forature speciali AngleDrill
local TgA = CosB / sqrt( 1 - CosB * CosB) local sDrilling3, sType3, dMaxDepth3 = ML.FindAngleDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
dSubL1 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA if sDrilling3 then
else sDrilling = sDrilling3
dMaxDepth = 0 sType = sType3
dMaxDepth = dMaxDepth3
bTryDrill = true
end end
end end
-- se foro davanti o dietro e inclinato, limito il massimo affondamento -- aggiusto affondamento e MaxElev
if dMaxDepth > 0 and abs( vtExtr:getY()) > abs( vtExtr:getZ()) then local dMaxElev
local CosB = abs( vtExtr:getZ()) local sMyWarn
if bInMid then -- se c'è un taglio precedente di testa o coda in cui il foro "entra" devo ricalcolare i dati della foratura
CosB = sqrt( vtExtr:getZ() * vtExtr:getZ() + vtExtr:getX() * vtExtr:getX()) if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then
end local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB)
if CosB < BD.DRILL_VX_MAX then if bIntersectionOk then
local TgA = CosB / sqrt( 1 - CosB * CosB) local dHoleToCutDistance = vDistance[1]
dSubL2 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA -- se il taglio accorcia realmente il foro
else if dHoleToCutDistance > 10 * GEO.EPS_SMALL and dHoleToCutDistance < dLen then
dMaxDepth = 0 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
end end
-- se foro sopra o sotto e inclinato, limito il massimo affondamento -- se foro da saltare per eccessiva inclinazione
if dMaxDepth > 0 and abs( vtExtr:getZ()) > abs( vtExtr:getY()) then if not bTryDrill then
local CosB = abs( vtExtr:getY()) sMyWarn = 'Warning in drill : too slant hole'
if bInMid then dDepth = 0
CosB = sqrt( vtExtr:getY() * vtExtr:getY() + vtExtr:getX() * vtExtr:getX()) return true, sMyWarn
end -- se non ridotto e affondamento richiesto supera il consentito
if CosB < BD.DRILL_VX_MAX then elseif not dMaxElev and dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
local TgA = CosB / sqrt( 1 - CosB * CosB) sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dSubL3 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA dDepth = dMaxDepth
else dMaxElev = dMaxDepth
dMaxDepth = 0
end
end
local dSubL = max( dSubL1, dSubL2, dSubL3)
if dMaxDepth > 0 then
dMaxDepth = min( dMaxDepth, dToolFreeLen - dSubL)
end end
-- inserisco la lavorazione -- inserisco la lavorazione
local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -380,14 +434,14 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eventuale inversione -- 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) EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
else else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert) EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
end end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE 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 nSCC = MCH_SCC.ADIR_YM
if AreSameVectorApprox( vtExtr, Z_AX()) then if AreSameVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM nSCC = MCH_SCC.ADIR_YM
@@ -402,20 +456,21 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nSCC = MCH_SCC.NONE nSCC = MCH_SCC.NONE
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- aggiusto l'affondamento -- imposto 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
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10.
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 -- Note utente con dichiarazione nessuna generazione sfridi per Vmill
local sUserNotes = 'VMRS=0;' local sUserNotes = 'VMRS=0;'
-- aggiungo alle note massima elevazione (coincide con affondamento) -- 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 -- 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;' sUserNotes = sUserNotes .. 'Open=1;'
end end
-- se lavorazione in doppio -- se lavorazione in doppio
@@ -426,14 +481,14 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
end end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
local bOk = EgtApplyMachining( true, false) local bOk = ML.ApplyMachining( true, false)
if not bOk and BD.DOWN_HEAD then if not bOk and bDownDrill then
if sType == 'Drill' or sType == 'Drill_H2' then if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
else else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end end
bOk = EgtApplyMachining( true, false) bOk = ML.ApplyMachining( true, false)
end end
if not bOk then if not bOk then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
+80 -22
View File
@@ -1,10 +1,12 @@
-- 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 -- Gestione calcolo mortase a coda di rondine per Travi
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
-- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto. -- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto.
-- 2021/06/28 Aggiunta gestione attacco e uscita con pocket. -- 2021/06/28 Aggiunta gestione attacco e uscita con pocket.
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST. -- 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). -- 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.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDtMortise = {} local ProcessDtMortise = {}
@@ -59,6 +61,10 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function ProcessDtMortise.Classify( Proc) 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 -- recupero i dati della curva di contorno della faccia di fondo
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end if not AuxId then return false end
@@ -91,8 +97,9 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol
local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId) local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId)
if not NewAuxId then return end if not NewAuxId then return end
-- ne allungo gli estremi -- ne allungo gli estremi
EgtExtendCurveStartByLen( NewAuxId, 100) EgtAddCurveCompoLineTg( NewAuxId, 100, false)
EgtExtendCurveEndByLen( NewAuxId, 100) EgtAddCurveCompoLineTg( NewAuxId, 100, true)
EgtMergeCurvesInCurveCompo( NewAuxId)
-- eseguo traslazione e offset per portarla sul top -- eseguo traslazione e offset per portarla sul top
local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL) local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL)
EgtMove( NewAuxId, vtMove, GDB_RT.GLOB) EgtMove( NewAuxId, vtMove, GDB_RT.GLOB)
@@ -118,6 +125,21 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol
return NewAuxId return NewAuxId
end 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 -- Applicazione della lavorazione
function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
@@ -141,15 +163,18 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local ptBC = EgtGP( AuxId, GDB_RT.GLOB) 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 -- 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) 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) local sErr = 'Machining from bottom impossible : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- determino l'altezza della mortasa (0=faccia di fondo) -- 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 b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
local dAltMort = b3DtMrt:getDimZ() 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 -- verifico se di tipo pocket
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1) local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
if bPocket then bMakeAntiSplitPath = false end if bPocket then bMakeAntiSplitPath = false end
@@ -201,9 +226,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
sMchExt = '_AT' sMchExt = '_AT'
end end
-- recupero la lavorazione : prima ricerca per sola tipologia -- 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 if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType) sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
end end
if not sMilling then if not sMilling then
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id) local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
@@ -211,9 +236,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo -- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad) sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown)
if not sMilling and bMillUp then 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 = '' sMchExt = ''
end end
if not sMilling then if not sMilling then
@@ -260,14 +285,14 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- recupero la lavorazione -- recupero la lavorazione
local sPocketing local sPocketing
sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam) sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam, nil, nil, bMillUp, bMillDown)
if not sPocketing and bMillUp then if not sPocketing and bMillUp then
sPocketing = ML.FindPocketing( 'Mortise', dToolDiam) sPocketing = ML.FindPocketing( 'Mortise', dToolDiam, nil, nil, bMillUp, bMillDown)
end end
if not sPocketing then 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 if not sPocketing and bMillUp then
sPocketing = ML.FindPocketing( 'Pocket', dToolDiam) sPocketing = ML.FindPocketing( 'Pocket', dToolDiam, nil, nil, bMillUp, bMillDown)
end end
end end
if not sPocketing then if not sPocketing then
@@ -289,18 +314,27 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;' local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
end end
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 -- se parametro interno abilitato e il percorso non è chiuso, aggiungo percorso e lavorazione antischeggia
if bMakeAntiSplitPath and not EgtCurveIsClosed( AuxId) then if bMakeAntiSplitPath and not EgtCurveIsClosed( AuxId) then
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId) local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup' local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -345,7 +379,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB) nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB)
end end
if not nId1 then if not nId1 then
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id) local sErr = 'Wrong geometry : Error on DtMortise '
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -367,11 +401,15 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- sistemo il lato e la direzione di lavoro -- 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.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true)) 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 -- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;' local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -389,13 +427,12 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
-- verifico se necessarie più passate (distanza all'imbocco ortogonale all'asse) -- verifico se necessarie più passate (distanza all'imbocco ortogonale all'asse)
local vtDiff = EgtEP( AuxId, GDB_RT.GLOB) - EgtSP( AuxId, GDB_RT.GLOB) 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 vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx
local dDist = vtOrtDiff:len() local dDist = min( vtOrtDiff:len(), dWidthMrt)
-- calcolo le passate -- calcolo le passate
local nPass = ceil( dDist / ( 1.9 * dToolDiam)) 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 for i = nPass, 1, -1 do
-- inserisco la lavorazione di contornatura -- inserisco la lavorazione di contornatura
local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass) local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass)
@@ -423,12 +460,33 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2) EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2)
EgtSetMachiningParam( MCH_MP.LIPERP, 5) EgtSetMachiningParam( MCH_MP.LIPERP, 5)
EgtSetMachiningParam( MCH_MP.LIELEV, 0) 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 end
-- dichiaro non si generano sfridi per VMill -- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;' local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr 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 -- Gestione calcolo tenone a coda di rondine per Travi
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 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 -- Tabella per definizione modulo
local ProcessDtTenon = {} local ProcessDtTenon = {}
@@ -19,32 +20,41 @@ local ML = require( 'MachiningLib')
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function VerifyOrientation( Proc, vtN, b3Raw) local function VerifyOrientation( Proc, vtN, b3Raw)
-- se PF con testa da sotto, ammessa qualunque orientazione -- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true return true
end end
-- se trave molto bassa -- se trave molto bassa
if b3Raw:getDimZ() <= 120 then if b3Raw:getDimZ() < 121 then
-- se tenone praticamente in asse, accetto fino a -45 deg -- 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) return ( vtN:getZ() >= -0.7072)
-- altrimenti accetto fino a -30deg -- altrimenti accetto fino a -30deg
else else
return ( vtN:getZ() >= -0.51) return ( vtN:getZ() >= -0.51)
end end
-- se trave bassa -- se trave bassa
elseif b3Raw:getDimZ() <= 200 then elseif b3Raw:getDimZ() < 201 then
-- se tenone praticamente in asse, accetto fino a -30 deg -- 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) return ( vtN:getZ() >= -0.51)
-- altrimenti accetto fino a -20deg -- altrimenti accetto fino a -21deg
else 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 end
-- se trave media -- se trave media
elseif b3Raw:getDimZ() <= 350 then elseif b3Raw:getDimZ() < 351 then
-- se tenone praticamente in asse, accetto fino a -22 deg -- 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) return ( vtN:getZ() >= -0.375)
-- altrimenti, accetto fino a -10 deg -- altrimenti, accetto fino a -10 deg
else else
@@ -102,7 +112,7 @@ local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -150,6 +160,9 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3) EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- porto inizio curva a Zmax -- porto inizio curva a Zmax
BL.PutStartOnTop( AuxId) 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 -- se tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
if not AreSameOrOppositeVectorApprox( vtN, X_AX()) or if not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
( Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dOvmHead - 100 * GEO.EPS_SMALL and ( 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) local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'DtTenon' local sMillType = 'DtTenon'
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', '')) local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -295,7 +305,13 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE 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 nSCC = MCH_SCC.ADIR_YM
if abs( vtExtr:getY()) > 0.088 then if abs( vtExtr:getY()) > 0.088 then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) 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 end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchRId, false) EgtSetOperationMode( nMchRId, false)
return false, sErr return false, sErr
+90 -9
View File
@@ -1,5 +1,6 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/07 -- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/07
-- Gestione calcolo profilo libero per Travi -- Gestione calcolo profilo libero per Travi
-- 2022/08/23 Aggiunta la funzione MakeByMark per la gestione del caso P13=10
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessFreeContour = {} local ProcessFreeContour = {}
@@ -233,14 +234,16 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dDepth = abs( EgtCurveThickness( AuxId)) local dDepth = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD) local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
local bToolInv = ( vtExtr:getZ() < -0.1) local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
local bDown = ( b3Aux:getMin():getZ() < b3Raw:getMin():getZ() + 5) local bDown = ( b3Aux:getMin():getZ() < b3Raw:getMin():getZ() + 5)
-- verifico se in testa o coda -- verifico se in testa o coda
local bHead = Proc.Head local bHead = Proc.Head
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva -- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true) local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
-- recupero la lavorazione -- recupero la lavorazione
local sMilling = ML.FindMilling( 'FreeContour') local bTopHead = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.1)
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
local sMilling = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, bTopHead, bDownHead)
if not sMilling then if not sMilling then
local sErr = 'Error : FreeContour not found in library' local sErr = 'Error : FreeContour not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -418,7 +421,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -479,7 +482,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -581,7 +584,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.OFFSR, dDepthCham) EgtSetMachiningParam( MCH_MP.OFFSR, dDepthCham)
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -600,7 +603,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
@@ -680,7 +683,7 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- imposto elevazione -- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';') EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -688,6 +691,76 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
return true return true
end 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 -- Applicazione della lavorazione
function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
@@ -698,7 +771,15 @@ function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
return MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead) return MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- altrimenti contornatura -- altrimenti contornatura
else 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
end end
+15 -13
View File
@@ -1,5 +1,6 @@
-- ProcessFrenchRidgeLap.lua by Egaltech s.r.l. 2020/02/11 -- ProcessFrenchRidgeLap.lua by Egaltech s.r.l. 2020/02/11
-- Gestione calcolo giunzione francese -- 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 -- Tabella per definizione modulo
local ProcessFrenchRidgeLap = {} local ProcessFrenchRidgeLap = {}
@@ -38,7 +39,9 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- 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 -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -117,25 +120,24 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dFinalExtraTrim = 0.1 local dFinalExtraTrim = 0.1
local dMiddleExtraTrim = 0.3 local dMiddleExtraTrim = 0.3
local dNullExtraTrim = 0 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 -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {} local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then 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 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 end
if #vCuts > 0 then 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 -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
@@ -192,7 +194,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- 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 bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
@@ -212,7 +214,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- 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 bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
+57 -22
View File
@@ -1,5 +1,8 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25 -- ProcessSplit.lua by Egaltech s.r.l. 2022/08/18
-- Gestione calcolo tagli di testa per Travi -- 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.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessHeadCut = {} local ProcessHeadCut = {}
@@ -8,6 +11,8 @@ local ProcessHeadCut = {}
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
EgtOutLog( ' ProcessHeadCut started', 1) EgtOutLog( ' ProcessHeadCut started', 1)
@@ -109,7 +114,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -132,7 +137,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -169,11 +174,25 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
end end
end end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) 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
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
end
end
-- caratteristiche taglio -- 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, abs( BD.MAX_DIM_HTCUT_HBEAM))
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM) local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) ( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * 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) local bHorizCut = ( not bBigSectionCut and ( 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 bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
-- dati geometrici del taglio -- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- se non obbligatorio e coincide con inizio grezzo, non va fatto -- se non obbligatorio e coincide con inizio grezzo, non va fatto
@@ -183,8 +202,33 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- determino se più tagli con offset -- determino se più tagli con offset
local nCuts = max( ceil( dOvmHead / ( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP)), 1) local nCuts = max( ceil( dOvmHead / ( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP)), 1)
local dOffsL = dOvmHead / nCuts local dOffsL = dOvmHead / nCuts
-- se taglio per sezioni alte e larghe
if bBigSectionCut then
if dOvmHead > 0 then
-- se finitura con lama
if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 then
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
if not bOk then return bOk, sErr end
-- se finitura con truciolatore
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 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 not bOk then return bOk, sErr end
end
end
-- se tagli standard -- se tagli standard
if not bDoubleHorizCut then elseif not bDoubleHorizCut then
-- flag di lavorazione faccia -- flag di lavorazione faccia
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT) local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
-- calcolo extra taglio ed accorciamento -- calcolo extra taglio ed accorciamento
@@ -219,23 +263,12 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
end end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna -- altrimenti necessari tagli da sopra e sotto con testa opportuna
else else
-- recupero la lavorazione con lama da sotto -- verifico esistenza della lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'HeadSide_H2')
if not sCutting2 then if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library' local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end 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 -- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ() local dDimZ = b3Raw:getDimZ()
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
@@ -248,16 +281,18 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0 local dAccStart = 0
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- eseguo i tagli da sotto necessari -- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL 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 if not bOk then return false, sErr end
end end
-- eseguo i tagli da sopra necessari -- eseguo i tagli da sopra necessari
for i = nCuts, 1, -1 do for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL 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 if not bOk then return false, sErr end
end end
end end
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+179 -393
View File
@@ -1,4 +1,4 @@
-- ProcessLongCut.lua by Egaltech s.r.l. 2021/11/08 -- ProcessLongCut.lua by Egaltech s.r.l. 2022/03/07
-- Gestione calcolo taglio longitudinale per Travi -- Gestione calcolo taglio longitudinale per Travi
-- 2021/02/03 Corretto FaceUse con fresa orizzontale su taglio orizzontale. -- 2021/02/03 Corretto FaceUse con fresa orizzontale su taglio orizzontale.
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto. -- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
@@ -9,6 +9,8 @@
-- 2021/10/29 Aggiunta opzione tipo lavorazione 'LongCut'. -- 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/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. -- 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).
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessLongCut = {} local ProcessLongCut = {}
@@ -98,7 +100,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim,
EgtSetMachiningParam( MCH_MP.LOPERP, 0) EgtSetMachiningParam( MCH_MP.LOPERP, 0)
EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30) EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -113,7 +115,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe
if sMasterCutting and #sMasterCutting > 0 then if sMasterCutting and #sMasterCutting > 0 then
sCutting = sMasterCutting sCutting = sMasterCutting
else else
sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', '')) sCutting = ML.FindCutting( 'HeadSide', not bMillDown, bMillDown)
end end
if not sCutting then if not sCutting then
local sErr = 'Error : HeadSide (cutting) not found in library' local sErr = 'Error : HeadSide (cutting) not found in library'
@@ -260,7 +262,7 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, s
EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC) EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC)
end end
-- rieseguo -- rieseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nIdMach, false) EgtSetOperationMode( nIdMach, false)
return false, false, sErr return false, false, sErr
@@ -319,10 +321,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId)
sNotes = sNotes .. 'VMRS=0;' sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca -- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -354,34 +356,37 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
bLimXmax = true bLimXmax = true
end end
end end
-- Verifico lato di lavorazione (limite di lato a 45deg per pinze che schiacciano) -- Verifico lato di lavorazione (limite di lato a 45deg per FAST e 36deg per PF)
-- 14.07.2021 su richieste di alcuni clienti, se taglio di lato (assegnazione +/- 2) fare lo stesso con la lama lasciando il cordone centrale
local nSide = 1 local nSide = 1
if vtN:getZ() < - 0.5 then if vtN:getZ() < - 0.5 then
nSide = -1 nSide = -1
elseif vtN:getY() < -0.7072 then elseif vtN:getY() < - EgtIf( BD.C_SIMM, 0.588, 0.7072) then
nSide = -2 nSide = -2
elseif vtN:getY() > 0.7072 then elseif vtN:getY() > EgtIf( BD.C_SIMM, 0.588, 0.7072) then
nSide = 2 nSide = 2
end end
-- Verifico se largo come faccia -- Verifico se largo come faccia
local bLarghAsFace = false local bLarghAsFace = false
if nSide == 1 or nSide == -1 then if nSide == 1 or nSide == -1 then
bLarghAsFace = ( Proc.Box:getDimY() > b3Solid:getDimY() - 10) bLarghAsFace = ( Proc.Box:getDimY() > b3Solid:getDimY() - 20)
else else
bLarghAsFace = ( Proc.Box:getDimZ() > b3Solid:getDimZ() - 10) bLarghAsFace = ( Proc.Box:getDimZ() > b3Solid:getDimZ() - 20)
end 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 -- determino se lavorazione da davanti o da dietro
local bFront = ( vtN:getY() < 0) local bFront = ( vtN:getY() < 0)
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo -- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4 local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID
local bForcedLim local bForcedLim
local sWarn 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) -- 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) -- 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 -- 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 laterale (prima l'arretramento era sempre del rggio utensile). -- fino al punto più vicino della faccia terminale (prima l'arretramento era sempre del raggio utensile).
-- Questo viene fatto se Q07=1 o fresa da sotto -- Questo viene fatto se Q07=1 o fresa da sotto
---------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------
local nUseBlade = EgtIf( bCustUseBlade, 1, EgtGetInfo( Proc.Id, 'Q05', 'i') or 0) local nUseBlade = EgtIf( bCustUseBlade, 1, EgtGetInfo( Proc.Id, 'Q05', 'i') or 0)
@@ -469,7 +474,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepthDn = 0 local dMaxDepthDn = 0
-- recupero la lavorazione -- recupero la lavorazione
if bCanUseUnderBlade then if bCanUseUnderBlade then
sCuttingDn = ML.FindCutting( 'HeadSide_H2') sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true)
if not sCuttingDn then if not sCuttingDn then
local sErr = 'Error : sawing HeadSide_H2 not found in library' local sErr = 'Error : sawing HeadSide_H2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -503,8 +508,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end end
end end
end end
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio. setto la fine come limitata local nNextRawId = EgtGetNextRawPart( nRawId)
if ( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2) and not bLimXmin then -- 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 if bForceUseBladeOnNotThruFace then
bForcedLim = true bForcedLim = true
bLimXmin = true bLimXmin = true
@@ -664,12 +670,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- determino la massima elevazione -- determino la massima elevazione
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
-- recupero la lavorazione -- recupero la lavorazione
local sMilling local sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bCanUseUnderBlade, bCanUseUnderBlade)
if bCanUseUnderBlade then
sMilling = ML.FindMilling( 'Long2Cut_H2', dElev)
else
sMilling = ML.FindMilling( 'Long2Cut', dElev)
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling Long2Cut (_H2) not found in library' local sErr = 'Error : milling Long2Cut (_H2) not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -756,31 +757,6 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dAddExtraPerp = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ() dAddExtraPerp = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
end end
dLioPerp = dLioPerp + dAddExtraPerp 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 end
-- inserisco le parti di lavorazione -- inserisco le parti di lavorazione
nM = nM + 1 nM = nM + 1
@@ -822,16 +798,6 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
if ( not bFront and k == 1) or ( bFront and k == 2) then if ( not bFront and k == 1) or ( bFront and k == 2) then
dSal, dEal = dEal, dSal dSal, dEal = dEal, dSal
end 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 if bCanUseBlade and bCanUseUnderBlade then
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
@@ -877,21 +843,24 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- imposto posizione braccio porta testa per non ingombrare agli estremi -- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
end end
end end
end end
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut -- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
elseif nSide ~= - 1 and nUseMillOnSide == 0 then elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then
-- determino la massima elevazione -- determino la massima elevazione
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
-- recupero la lavorazione -- 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 if not sMilling then
local sErr = 'Error : milling Long2Cut not found in library' local sErr = 'Error : milling '..sMchType..' not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1043,7 +1012,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dDepth = min( 0, dMaxDepth - dElev ) local dDepth = min( 0, dMaxDepth - dElev )
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -1081,9 +1050,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
nCountMilHead = nCountMilHead + 1 nCountMilHead = nCountMilHead + 1
end end
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 else
-- da Analisi con Fabio Squaratti 15/09/2020
-- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco -- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco
local bRemoveToolRadius local bRemoveToolRadius
-- se nExtendMach = 0 la lavorazione rimane arretrata dalla fine della faccia del raggio utensile -- se nExtendMach = 0 la lavorazione rimane arretrata dalla fine della faccia del raggio utensile
@@ -1091,12 +1060,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) -- se nExtendMach = 2 la lavorazione viene estesa ma arretra per non segnare il pezzo successivo (se non ha facce limite)
local nExtendMach local nExtendMach
-- recupero la lavorazione -- recupero la lavorazione
local sMilling local sMchType, sMchTypeDn
local sMillingDn local sMilling, sMillingDn
local sPrefix local sPrefix, sPrefixDn
local sPrefixDn
if nSide ~= - 1 then if nSide ~= - 1 then
sMilling = ML.FindMilling( 'Long2CutSide') sMchType = 'Long2CutSide'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CS_' sPrefix = 'L2CS_'
nExtendMach = nUseMillOnSide nExtendMach = nUseMillOnSide
if nUseMillOnSide == 2 then if nUseMillOnSide == 2 then
@@ -1104,30 +1073,33 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end end
-- se testa da sotto -- se testa da sotto
if nSide ~= 1 and BD.DOWN_HEAD then 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_' sPrefixDn = 'L2CSH2_'
end end
-- lavorazione da sotto -- lavorazione da sotto
else else
sMilling = ML.FindMilling( 'Long2CutDown') sMchType = 'Long2CutDown'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CD_' sPrefix = 'L2CD_'
nExtendMach = 1 nExtendMach = 1
if nUseMillOnSide ~= 1 then 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 end
-- se testa da sotto -- se testa da sotto
if BD.DOWN_HEAD then 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_' sPrefixDn = 'L2CDH2_'
end end
end end
if not sMilling then if not sMilling and ( nSide == 1 or not BD.DOWN_HEAD) then
local sErr = 'Error : milling Long2CutSide or Long2CutDown not found in library' local sErr = 'Error : milling '..sMchType..' not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
if nSide ~= 1 and BD.DOWN_HEAD and not sMillingDn then if not sMilling and not sMillingDn then
local sErr = 'Error : milling Long2CutSide_H2 or Long2CutDown_H2 not found in library' local sErr = 'Error : milling '..sMchType..' and '..sMchTypeDn..' not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1137,9 +1109,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepth = 0 local dMaxDepth = 0
local dThDiam = 0 local dThDiam = 0
local dThLen = 0 local dThLen = 0
local dExtraForSafety = EgtIf( BD.DOWN_HEAD, 8.5, 6.5) -- corrisponde al doppio valore di sicurezza dell'mlpe + 0.5 if sMilling and EgtMdbSetCurrMachining( sMilling) then
-- local dExtraForSafetyDn = 8.5 -- 8.5 -- corrisponde al doppio valore di sicurezza dell'mlpe + 0.5
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
@@ -1155,7 +1125,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepthDn = 0 local dMaxDepthDn = 0
local dThDiamDn = 0 local dThDiamDn = 0
local dThLenDn = 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) local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiamDn = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiamDn dToolDiamDn = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiamDn
@@ -1165,19 +1135,17 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dThLenDn = EgtTdbGetCurrToolThLength() or dThLenDn dThLenDn = EgtTdbGetCurrToolThLength() or dThLenDn
end end
end end
-- distanza dalle eventuali facce estreme
local dDistToEnd = dToolDiam / 2 local dDistToEnd = dToolDiam / 2
local dDistToEndDn = dToolDiamDn / 2 local dDistToEndDn = dToolDiamDn / 2
-- calcolo l'elevazione della faccia principale -- calcolo l'elevazione della faccia principale
local dFacElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) 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 -- 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 then if ( nUseMillOnSide <= 1 or nSide == -1) and dFacElev < dToolDiam / 2 then
if dFacElev < dDistToEnd then dDistToEnd = sqrt( dFacElev * ( dToolDiam - dFacElev))
dDistToEnd = sqrt( ( ( dToolDiam / 2) * ( dToolDiam / 2)) - ( ( dToolDiam / 2 - dFacElev) * (dToolDiam / 2 - dFacElev))) end
end if nUseMillOnSide <= 1 and dFacElev < dToolDiamDn / 2 then
if dFacElev < dDistToEndDn then dDistToEndDn = sqrt( dFacElev * ( dToolDiamDn - dFacElev))
dDistToEndDn = sqrt( ( ( dToolDiamDn / 2) * ( dToolDiamDn / 2)) - ( ( dToolDiamDn / 2 - dFacElev) * (dToolDiamDn / 2 - dFacElev)))
end
end end
-- se la fine è già limitata allora setto per arretrare del raggio utensile -- se la fine è già limitata allora setto per arretrare del raggio utensile
if bLimXmin then if bLimXmin then
@@ -1252,123 +1220,134 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dEndAccDist = 0 dEndAccDist = 0
end end
end end
-- verifico se posso farlo da due parti opposte o da solo una parte -- verifico se posso farlo da una sola parte o se necessario da due parti
local dCollSic local dMaxDepthZ = dMaxDepth
local dCollSicMin local dMaxDepthDnZ = dMaxDepthDn
local dCollSicDn local CosA = abs( vtN:getZ())
local dCollSicMinDn if CosA >= 0.05 then
local dDepth local SinA = sqrt( 1 - CosA * CosA)
local dDepthDn local dRad = dThDiam / 2 - dToolDiam / 2 + BD.COLL_SIC
local dDepth2 dMaxDepthZ = dMaxDepthZ - ( dRad * CosA / SinA)
local dDepth2Dn if sMillingDn then
local nPass = 1 local dRadDn = dThDiamDn / 2 - dToolDiamDn / 2
local dNz = EgtIf( abs(nSide) == 1, vtN:getY(), vtN:getZ()) dMaxDepthDnZ = dMaxDepthDnZ - ( dRadDn * CosA / SinA)
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
end end
dCollSicMin = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin)) end
if bLarghAsFace then local dMaxDepthY = dMaxDepth
dCollSic = max( BD.COLL_SIC, dSicOnRad * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegth) local dMaxDepthDnY = dMaxDepthDn
else local SinA = abs( vtN:getZ())
dCollSic = max( BD.COLL_SIC, dSicOnRad * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(nSide) == 1, vtN:getZ(), vtN:getY()) / dNz)) + dSicOnLegth) 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 end
if nSide ~= 1 and BD.DOWN_HEAD then end
local dSicOnRadDn local nPass = 0
local dSicOnLegthDn local vdMaxD = { 0, 0}
if ( abs(nSide) == 1 and abs(vtN:getZ()) >= abs(vtN:getY())) or ( abs(nSide) == 2 and abs(vtN:getY()) >= abs(vtN:getZ())) then local vnHead = { 0, 0}
dSicOnRadDn = ( dThDiamDn + dExtraForSafety - dToolDiamDn) / 2 -- con testa da sopra
dSicOnLegthDn = 0 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 else
dSicOnRadDn = ( dThDiamDn - dToolDiamDn) / 2 nPass = 2
dSicOnLegthDn = dExtraForSafety / 2 dAgg = BD.CUT_EXTRA_MIN
vdMaxD[2] = dMaxDepthY
end end
dCollSicMinDn = max( BD.COLL_SIC, ( dThDiamDn - dToolDiamDn) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin)) -- se altrimenti faccia sotto
if bLarghAsFace then elseif nSide == -1 then
dCollSicDn = max( BD.COLL_SIC, dSicOnRadDn * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegthDn) if dWidth + dAgg <= dMaxDepthY or abs( vtN:getY()) > EgtIf( BD.C_SIMM, 0.588, 0.7072) then
nPass = 1
vdMaxD[1] = dMaxDepthY
else 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 nPass = 2
dAgg = 1 vdMaxD[1] = dMaxDepthY
if ( 0.5 * dWidth) + dAgg > dMaxDepth - dCollSic then local dDelta = b3Solid:getDimY() - Proc.Box:getDimY()
sWarn = 'Warning in LongCut : depth is bigger than max tool depth' if bLarghAsFace then
end vdMaxD[2] = min( dMaxDepthY, dMaxDepth - dDelta * abs( vtN:getZ()) - BD.COLL_SIC)
end else
if nPass == 1 and dWidth + dAgg > dMaxDepthDn - dCollSicDn then vdMaxD[2] = min( dMaxDepthZ, dToolLength - 5 - dDelta / abs( vtN:getZ()) - BD.COLL_SIC)
nPass = 2
dAgg = 1
if ( 0.5 * dWidth) + dAgg > dMaxDepthDn - dCollSicDn then
sWarn = 'Warning in LongCut_2 : depth is bigger than max tool depth'
end end
if vdMaxD[2] < 0 then nPass = 1 end
if nPass == 2 then dAgg = BD.CUT_EXTRA_MIN end
end end
-- altrimenti faccia di fianco
else else
if dWidth + dAgg > dMaxDepth - dCollSic then nPass = 1
nPass = 2 local dDelta = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
dAgg = 1 if abs( vtN:getY()) < 0.866 then
if ( 0.5 * dWidth) + dAgg > dMaxDepth - dCollSic then vdMaxD[1] = dMaxDepthY
sWarn = 'Warning in LongCut : depth is bigger than max tool depth' elseif bTopStart then
end 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 end
if vdMaxD[1] < 0 then nPass = 0 end
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 else
-- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica) vnHead = { 2, 2}
-- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione -- se faccia sotto
local dSicOnRad if nSide == -1 then
local dSicOnLegth vdMaxD[1] = EgtIf( bLarghAsFace, dMaxDepthDnY, dMaxDepthDnZ)
if ( abs(nSide) == 1 and abs(vtN:getZ()) >= abs(vtN:getY())) or ( abs(nSide) == 2 and abs(vtN:getY()) >= abs(vtN:getZ())) then if dWidth + dAgg <= vdMaxD[1] then
dSicOnRad = ( dThDiam + dExtraForSafety - dToolDiam) / 2 nPass = 1
dSicOnLegth = 0 else
nPass = 2
dAgg = BD.CUT_EXTRA_MIN
vdMaxD[2] = dMaxDepthDnY
end
-- altrimenti faccia di fianco
else else
dSicOnRad = ( dThDiam - dToolDiam) / 2 nPass = 1
dSicOnLegth = dExtraForSafety / 2 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 end
dCollSicMin = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin)) -- eventuale errore per lavorazione saltata
-- dCollSic = max( BD.COLL_SIC, dSicOnRad * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(nSide) == 1, vtN:getY(), vtN:getZ()) / dNz)) + dSicOnLegth) if nPass == 0 then
dCollSic = max( BD.COLL_SIC, dSicOnRad * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegth) local sErr = 'Error in '..sMchType..' : impossible machining'
if dWidth + dAgg > dMaxDepth - dCollSic then EgtOutLog( sErr)
sWarn = 'Warning in LongCut : depth is bigger than max tool depth' return false, sErr
end end
end -- eventuale avviso per lavorazione incompleta
-- profondità prima passata if dWidth + nPass * dAgg > vdMaxD[1] + vdMaxD[2] then
dDepth = min( dMaxDepth - dCollSicMin, dWidth + dAgg) sWarn = 'Warning in '..sMchType..' : depth is bigger than max tool depth'
-- 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)
end end
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 -- ciclo sulle parti
local nM = 0 local nM = 0
local bMakeMillHeadEnd local bMakeMillHeadEnd
local bMakeMillHeadStart local bMakeMillHeadStart
local dLioPerp1 = dFacElev + BD.COLL_SIC local dLioPerp1 = dFacElev + BD.COLL_SIC
-- local dLioPerp2 = dWidth + 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
local dLioPerp2 = dWidth * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, sqrt( 1 - dNz * dNz) / abs( dNz)) + BD.COLL_SIC
-- valore sovrapposizione tra passate -- valore sovrapposizione tra passate
local dOverLapExtend = 2 local dOverLapExtend = 2 * BD.CUT_EXTRA_MIN
for j = 1, nC do for j = 1, nC do
-- Limitazioni della lavorazione -- Limitazioni della lavorazione
local nPos = EgtIf( bFront, j, nC - j + 1) local nPos = EgtIf( bFront, j, nC - j + 1)
@@ -1376,11 +1355,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dEal = EgtIf( nPos == nC, -dStartDist, -dStartAccDist - ( nC - nPos - 1) * dC + dOverLapExtend) local dEal = EgtIf( nPos == nC, -dStartDist, -dStartAccDist - ( nC - nPos - 1) * dC + dOverLapExtend)
-- Posizione braccio portatesta -- Posizione braccio portatesta
local nSCC local nSCC
local dExtraElev_1st = 0
local dExtraElevDn_1st = 0
for k = 1, nPass do for k = 1, nPass do
-- if EgtIf( k == 1, bFront, not bFront) then
if 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) nSCC = EgtIf( ( BD.C_SIMM or j == 1 or j == nC - 1), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
else else
@@ -1388,31 +1363,19 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end end
-- inserisco le parti di lavorazione -- inserisco le parti di lavorazione
nM = nM + 1 nM = nM + 1
local sNameF local sNameF = EgtIf( vnHead[k] ~= 2, sPrefix, sPrefixDn) .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
local nMchFId local nMchFId = EgtAddMachining( sNameF, EgtIf( vnHead[k] ~= 2, sMilling, sMillingDn))
if BD.DOWN_HEAD and k == 2 and nSide ~= 1 then if not nMchFId then
sNameF = sPrefixDn .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM) local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMillingDn
nMchFId = EgtAddMachining( sNameF, sMillingDn) EgtOutLog( sErr)
if not nMchFId then return false, sErr
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
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, 0}}) EgtSetMachiningGeometry( {{ Proc.Id, 0}})
-- imposto posizione braccio porta testa per non ingombrare agli estremi -- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto uso faccia -- 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 if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then nUseFace = MCH_MILL_FU.PARAL_BACK end
EgtSetMachiningParam( MCH_MP.FACEUSE, nUseFace) EgtSetMachiningParam( MCH_MP.FACEUSE, nUseFace)
-- imposto lato di lavoro e inversione -- imposto lato di lavoro e inversione
@@ -1429,194 +1392,17 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
-- assegno affondamento -- assegno affondamento
local dExtraElev = 0 EgtSetMachiningParam( MCH_MP.DEPTH, vdDepth[k])
local dExtraElevDn = 0 -- assegno attacco perpendicolare
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.LIPERP, dLioPerp1) EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1)
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1) EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1)
-- eseguo -- 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 -- se feature orientata su faccia da sotto provo a cambiare l'attacco
if nSide == -1 then if nSide == -1 then
EgtSetMachiningParam( MCH_MP.LIPERP, min( dLioPerp1, dLioPerp2)) EgtSetMachiningParam( MCH_MP.LIPERP, min( dLioPerp1, dLioPerp2))
EgtSetMachiningParam( MCH_MP.LOPERP, 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() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
-- esco se non sono nella seconda lavorazione o non nella faccia da sotto -- 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 -- Gestione calcolo doppio taglio longitudinale per Travi
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto. -- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
-- 2021/06/29 Corretta gestione caso equivalente a due smussi. -- 2021/06/29 Corretta gestione caso equivalente a due smussi.
-- 2021/10/29 Aggiunta opzione tipo lavorazione 'LongCut'. -- 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. -- 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 -- Tabella per definizione modulo
local ProcessLong2Cut = {} local ProcessLong2Cut = {}
@@ -141,7 +146,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, nL2CSide)
EgtSetMachiningParam( MCH_MP.STARTPOS, 80) EgtSetMachiningParam( MCH_MP.STARTPOS, 80)
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -152,8 +157,9 @@ end
-- Applicazione della lavorazione -- Applicazione della lavorazione
local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, dFacElev) local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, dFacElev)
-- cerco la svuotatura opportuna -- cerco la svuotatura opportuna
local sPockType = EgtIf( nSide ~=1 and BD.DOWN_HEAD, 'OpenPocket_H2', 'OpenPocket') local bDownHead = nSide ~=1 and BD.DOWN_HEAD
local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX()) local sPockType = EgtIf( bDownHead, 'OpenPocket_H2', 'OpenPocket')
local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX(), nil, nil, not bDownHead, bDownHead)
if not sPocketing then if not sPocketing then
local sErr = 'Error : OpenPocket not found in library' local sErr = 'Error : OpenPocket not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -194,10 +200,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, d
sNotes = sNotes .. 'VMRS=0;' sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca -- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -250,7 +256,7 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex,
end end
end end
else 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 bCanUseBlade = true
end end
end end
@@ -290,9 +296,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- verifico posizione (+1=sopra, -1=sotto, 0=sui lati) -- verifico posizione (+1=sopra, -1=sotto, 0=sui lati)
local nSide = 0 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 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 nSide = -1
end end
@@ -301,39 +307,21 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local bConvex local bConvex
local bOrtho local bOrtho
local ptM local ptM
local ptRef = ( ptC[1] + ptC[2]) / 2
if bInt then if bInt then
bConvex = ( dAng >= 0) bConvex = ( dAng >= 0)
bOrtho = ( abs( dAng + 90) < 1) bOrtho = ( abs( dAng + 90) < 1)
ptM = ( ptP1 + ptP2) / 2 ptM = ( ptP1 + ptP2) / 2
else 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 bOrtho = false
dAng = acos( vtN[1] * vtN[2]) 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 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 -- 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 5.4
@@ -365,23 +353,41 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- verifico se posso usare lame -- verifico se posso usare lame
local bCanUseBlade, bCanUseUnderBlade = CalcBladeUse( bUseBlade, BD.DOWN_HEAD, nSide, vtN[1], vtN[2], bConvex) 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 -- 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 if bUseBlade and not BD.DOWN_HEAD and not bCanUseBlade then
local sErr = 'Error, impossible use blade on too negative face' local sErr = 'Error, impossible use blade on too negative face'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, 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 elseif bUseBlade and BD.DOWN_HEAD and not bCanUseBlade and not bCanUseUnderBlade then
local sErr = 'Error, impossible use blade' local sErr = 'Error, impossible use blade'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end 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 -- 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 if nFaceLimit == 0 and ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
local sCutting local sCutting
@@ -394,7 +400,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local dMaxDepthDn = 0 local dMaxDepthDn = 0
-- recupero la lavorazione -- recupero la lavorazione
if bCanUseUnderBlade then if bCanUseUnderBlade then
sCuttingDn = ML.FindCutting( 'HeadSide_H2') sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true)
if not sCuttingDn then if not sCuttingDn then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing underneath not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing underneath not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -503,8 +509,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dC = dCDn dC = dCDn
end end
-- disabilitato la selezione del codolo, prende sempre quello più piccolo. Non cancellare quello disabiliato in caso di ripristino -- uso codolo piccolo
-- local dDimStrip = EgtIf( nSide ~= 0, BD.DIM_STRIP_SMALL, BD.DIM_STRIP)
local dDimStrip = BD.DIM_STRIP_SMALL * EgtIf( nSide == -1, -1, 1) local dDimStrip = BD.DIM_STRIP_SMALL * EgtIf( nSide == -1, -1, 1)
local nM = 0 local nM = 0
-- se convesso lavoro ogni faccia in due metà lasciando attaccata la parte centrale -- 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 nMchFId
local sCuttingName local sCuttingName
local bMachDown local bMachDown
-- if ( k == 1 and bCanUseBlade) or ( k == 2 and ( bCanUseBlade and not bCanUseUnderBlade)) then
if bCanUseBlade and not bCanUseUnderBlade then if bCanUseBlade and not bCanUseUnderBlade then
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM) sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCutting) nMchFId = EgtAddMachining( sNameF, sCutting)
@@ -580,7 +584,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- setto le variabili delle distanze dagli estremi -- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistUp dEndAccDist = dEndAccDistUp
dStartAccDist = dStartAccDistUp dStartAccDist = dStartAccDistUp
-- elseif ( k == 2 and bCanUseUnderBlade) or ( k == 1 and ( bCanUseUnderBlade and not bCanUseBlade)) then
elseif bCanUseUnderBlade and not bCanUseBlade then elseif bCanUseUnderBlade and not bCanUseBlade then
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM) sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCuttingDn) nMchFId = EgtAddMachining( sNameF, sCuttingDn)
@@ -677,15 +680,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dSal, dEal = dEal, dSal dSal, dEal = dEal, dSal
end end
if bCanUseBlade and bCanUseUnderBlade then 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 if bCanUseBlade and nSide == -1 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- imposto uso della faccia -- 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 -- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr 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 -- 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 -- dovrebbe essere il limite angolare della testa 1 in sottosquadra
if nSide == -1 and not BD.DOWN_HEAD then 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 dSinLimit = -0.0157
else else
dSinLimit = -0.5 dSinLimit = -0.5
@@ -858,7 +852,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- determino e imposto l'utilizzo della faccia -- determino e imposto l'utilizzo della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]]) EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]])
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -866,8 +860,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
end end
end end
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut -- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
elseif ( ( nSide ~= -1 or BD.DOWN_HEAD) 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 -- determino la massima elevazione
local dElev = 0 local dElev = 0
local dFacElev1 = BL.GetFaceElevation( Proc.Id, tFaceLong[1], nPartId) local dFacElev1 = BL.GetFaceElevation( Proc.Id, tFaceLong[1], nPartId)
@@ -881,11 +876,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
-- recupero la lavorazione -- recupero la lavorazione
local sMilling local sMilling
if nSide == -1 and BD.DOWN_HEAD then local bDownHead = ( nSide == -1 and BD.DOWN_HEAD)
sMilling = ML.FindMilling( 'Long2Cut_H2', dElev) sMilling = ML.FindMilling( 'Long2Cut', dElev, nil, nil, nil, not bDownHead, bDownHead)
else
sMilling = ML.FindMilling( 'Long2Cut', dElev)
end
if not sMilling then if not sMilling then
local sErr = 'Error : Long2Cut not found in library' local sErr = 'Error : Long2Cut not found in library'
@@ -908,10 +900,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo più distante da metà raggio. setto la fine come limitata -- se ho un pezzo successivo più distante di metà raggio : setto la fine come limitata
if dDistToNextPiece < dToolDiam/2 and nFaceLimit < 2 then if dDistToNextPiece < dToolDiam/2 then
bForcedLim = true bForcedLim = true
nFaceLimit = nFaceLimit + 2 nFaceLimit = nFaceLimit | 2
end end
-- se chiuso e corto, applico svuotatura con fresa opportuna -- se chiuso e corto, applico svuotatura con fresa opportuna
if nFaceLimit == 3 and Proc.Box:getDimX() < 2 * dToolDiam then 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 local nIncStep = 2
if bStartFixed and bEndFixed then if bStartFixed and bEndFixed then
dC = ( dLen - dStartAccDist - dEndAccDist) / nC 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) local dMinDist = EgtIf( min( dStartAccDist, dEndAccDist) / 2 > 300 , 300, min( dStartAccDist, dEndAccDist) / 2)
if dC < dMinDist then if dC < dMinDist then
dC = dLen / ( nC + 2) dC = dLen / ( nC + 1)
dStartAccDist = dC dStartAccDist = dC
dEndAccDist = dC dEndAccDist = dC
nIncStep = 1 nIncStep = 1
@@ -1032,6 +1024,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
end end
end end
if nIni == 2 then
dStartDist, dEndDist = dEndDist, dStartDist
dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist
end
-- ciclo sulle parti -- ciclo sulle parti
local nM = 0 local nM = 0
for j = 1, nC do 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 -- valore sovrapposizione tra passate con fresa di fianco
local dOverLapExtend = 2 local dOverLapExtend = 2
-- Verifico se da fare di fianco perchè normale troppo verso il basso (minore di -30deg) -- 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 -- Limitazioni della lavorazione
local nPos = EgtIf( i == 1, j, nC - j + 1) 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)) 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 -- Posizione braccio portatesta
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then 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 end
if bSide and not bConvex then if bSide and not bConvex then
dSal, dEal = dEal, dSal dSal, dEal = dEal, dSal
@@ -1110,7 +1116,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.STARTPOS, 80) EgtSetMachiningParam( MCH_MP.STARTPOS, 80)
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -1126,7 +1132,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
end end
end end
-- altrimenti è sotto : lavorazione Long2CutDown
-- altrimenti lavorazione di fianco : Long2CutSide o Long2CutDown
else else
-- da Analisi con Fabio Squaratti 15/09/2020 -- da Analisi con Fabio Squaratti 15/09/2020
-- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco -- 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) -- se nExtendMach = 2 la lavorazione viene estesa ma arretra per non segnare il pezzo successivo (se non ha facce limite)
local nExtendMach local nExtendMach
-- recupero la lavorazione -- recupero la lavorazione
local sMilling local sMchType, sMchTypeDn
local sMillingDn local sMilling, sMillingDn
local sPrefix local sPrefix, sPrefixDn
local sPrefixDn
if nSide ~= - 1 then if nSide ~= - 1 then
sMilling = ML.FindMilling( 'Long2CutSide') sMchType = 'Long2CutSide'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CS_' sPrefix = 'L2CS_'
nExtendMach = nUseMillOnSide nExtendMach = nUseMillOnSide
if nUseMillOnSide == 2 then if nUseMillOnSide == 2 then
bRemoveToolRadius = true bRemoveToolRadius = true
-- nExtendMach = 0 -- arretro la lavorazione del raggio utensile (se non ha facce limite)
end end
-- se testa da sotto -- se testa da sotto
if nSide ~= 1 and BD.DOWN_HEAD then 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_' sPrefixDn = 'L2CSH2_'
end end
-- lavorazione da sotto -- lavorazione da sotto
else else
sMilling = ML.FindMilling( 'Long2CutDown', nil, nil, EgtIf( nUseMillOnSide > 0, 150, 50)) sMchType = 'Long2CutDown'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CD_' sPrefix = 'L2CD_'
nExtendMach = 1 nExtendMach = 1
if nUseMillOnSide ~= 1 then if nUseMillOnSide ~= 1 then
@@ -1163,17 +1171,18 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
-- se testa da sotto -- se testa da sotto
if BD.DOWN_HEAD then 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_' sPrefixDn = 'L2CDH2_'
end end
end end
if not sMilling then if not sMilling and ( nSide == 1 or not BD.DOWN_HEAD) then
local sErr = 'Error : Long2CutSide or Long2CutDown not found in library' local sErr = 'Error : milling '..sMchType..' not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
if nSide ~= 1 and BD.DOWN_HEAD and not sMillingDn then if not sMilling and not sMillingDn then
local sErr = 'Error : Long2CutSide_H2 or Long2CutDown_H2 not found in library' local sErr = 'Error : milling '..sMchType..' and '..sMchTypeDn..' not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -1263,20 +1272,43 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local nC = ceil( ( dLen - dStartAccDist - dEndAccDist) / BD.LONGCUT_MAXLEN) local nC = ceil( ( dLen - dStartAccDist - dEndAccDist) / BD.LONGCUT_MAXLEN)
local dC = 0 local dC = 0
if nC > 0 then if nC > 0 then
local nIncStep = 2
if bStartFixed and bEndFixed then if bStartFixed and bEndFixed then
dC = ( dLen - dStartAccDist - dEndAccDist) / nC 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 elseif bStartFixed then
dC = ( dLen - dStartAccDist) / ( nC + 1) dC = ( dLen - dStartAccDist) / ( nC + 1)
dEndAccDist = dC dEndAccDist = dC
if dC < dStartAccDist then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
elseif bEndFixed then elseif bEndFixed then
dC = ( dLen - dEndAccDist) / ( nC + 1) dC = ( dLen - dEndAccDist) / ( nC + 1)
dStartAccDist = dC dStartAccDist = dC
if dC < dEndAccDist then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
else else
dC = dLen / ( nC + 2) dC = dLen / ( nC + 2)
dStartAccDist = dC dStartAccDist = dC
dEndAccDist = dC dEndAccDist = dC
end end
nC = nC + 2 nC = nC + nIncStep
else else
if dLen > min( dStartAccDist, dEndAccDist) then if dLen > min( dStartAccDist, dEndAccDist) then
nC = 2 nC = 2
@@ -1377,7 +1409,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
if BD.DOWN_HEAD and nSide ~= 1 then if BD.DOWN_HEAD and nSide ~= 1 then
local ptC3 = EgtSurfTmFacetCenter( Proc.Id, tFaceLong[vOrd[i]], GDB_ID.ROOT) local ptC3 = EgtSurfTmFacetCenter( Proc.Id, tFaceLong[vOrd[i]], GDB_ID.ROOT)
local ptDir = ptC3 - ptM ; ptDir:normalize() 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 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 ( bConvex and vtN[vOrd[i]]:getZ() > -0.866 and ptDir:getZ() > 0) then
sNameF = sPrefix .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM) 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) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- se fresa di fianco e non da sotto -- se fresa di fianco e non da sotto
if nUseMillOnSide > 0 and nSide ~= -1 then if nUseMillOnSide > 0 and nSide ~= -1 then
-- se faccia da sopra o di fianco if bConvex then
if nSide >= 0 then local vFaceUse2
if bConvex then -- se da sopra
local vFaceUse2 if nSide == 1 then
-- se da sopra if vtN[vOrd[i]]:getZ() > 0.866 then
if nSide == 1 then vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 1, 2)], vtN[EgtIf(vOrd[i] == 1, 2, 1)])
if vtN[vOrd[i]]:getZ() > 0.866 then EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 1, 2)], vtN[EgtIf(vOrd[i] == 1, 2, 1)]) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
-- 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
else else
if vtN[vOrd[i]]:getY() > 0.866 then EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
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
end end
-- se concavo -- altrimenti è di fianco
else else
local vFaceUse2 if vtN[vOrd[i]]:getY() > 0.866 then
-- se da sopra EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_TOP)
if nSide == 1 then EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
-- vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)]) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)])
-- altrimenti è di fianco
else else
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)]) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
end end
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
end end
-- questa parte non viene mai eseguita -- se concavo
-- se faccia da sotto else
-- else local vFaceUse2
-- if bConvex then -- se da sopra
-- EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN) if nSide == 1 then
-- if vtN[vOrd[i]]:getZ() >= 0 then vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)])
-- EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal) -- altrimenti è di fianco
-- EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal) else
-- end vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
-- else end
-- -- lascio lo stesso le lavorazioni anche se viene intercettato l'errore EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
-- local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)]) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
-- EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
-- if vtN[vOrd[i]]:getZ() < 0 then
-- EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
-- EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
-- end
-- end
end end
else else
-- se con fresa di fianco -- se con fresa di fianco
@@ -1492,7 +1501,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end end
else else
-- lascio lo stesso le lavorazioni anche se viene intercettato l'errore -- 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)]) local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)])
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2) EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
if vtN[vOrd[i]]:getZ() < 0 then 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(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 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 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 -- nel caso concavo, devo impostare la lunghezza di attacco ortogonale
if not bConvex then if not bConvex then
dLioPerp1 = EgtIf( i == 1, dFacElev1, dFacElev2) local dLioPerp = EgtIf( i == 1, dFacElev1, dFacElev2) + BD.COLL_SIC
-- dLioPerp1 = vWidth[vOrd[i]] * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, sqrt( 1 - dNz * dNz) / abs( dNz)) + BD.COLL_SIC EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp)
dLioPerp2 = vWidth[ EgtIf( vOrd[i] == 1, 2,1)] + BD.COLL_SIC EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
EgtSetMachiningParam( MCH_MP.LIPERP, max( dLioPerp1, dLioPerp2))
EgtSetMachiningParam( MCH_MP.LOPERP, max( dLioPerp1, dLioPerp2))
end end
-- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica) -- 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 -- 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 dDepth2 = vWidth[vOrd[i]] + dAgg - dDepth
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev)
end end
-- EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
-- se feature orientata su faccia da sotto e concave provo a cambiare l'attacco local _, sErr = EgtGetLastMachMgrError()
if nSide == -1 and not bConvex then EgtSetOperationMode( nMchFId, false)
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1) return false, sErr
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
end end
-- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra) -- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra)
if bConvex and j == 1 and not bStartFixed and bRemoveToolRadius then 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 -- Gestione calcolo marcatura per Travi
-- 2020/05/28 Tipo di lavorazione passato da Mark a Text. -- 2020/05/28 Tipo di lavorazione passato da Mark a Text.
-- 2021/05/03 Aggiunta gestione testa da sotto. -- 2021/05/03 Aggiunta gestione testa da sotto.
@@ -60,7 +60,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
return false, sErr return false, sErr
end end
-- verifico che la marcatura non sia orientata verso il basso (-5 deg) -- 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' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, 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) local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Text' local sMillType = 'Text'
local sMchExt = EgtIf( bMillDown, '_H2', '') --local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType..sMchExt) local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
if not sMilling then if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -97,7 +94,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -121,7 +118,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchF2Id, false) EgtSetOperationMode( nMchF2Id, false)
return false, sErr return false, sErr
+183 -14
View File
@@ -2,6 +2,8 @@
-- Gestione calcolo mortase per Travi -- Gestione calcolo mortase per Travi
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST. -- 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). -- 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.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessMortise = {} local ProcessMortise = {}
@@ -79,6 +81,155 @@ function ProcessMortise.GetCutPlane( Proc)
end 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
---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- ingombro del pezzo -- ingombro del pezzo
@@ -157,7 +308,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local dMove = bxMin:getZ()-bxMax:getZ() local dMove = bxMin:getZ()-bxMax:getZ()
-- se il percorso ausiliario è esterno al grezzo, lo riavvicino -- se il percorso ausiliario è esterno al grezzo, lo riavvicino
if abs( dMove) > GEO.EPS_SMALL then if abs( dMove) > GEO.EPS_SMALL then
AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup(nPartId)) AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup( nPartId))
EgtMove( AuxId, Vector3d(0,0,-dMove)) EgtMove( AuxId, Vector3d(0,0,-dMove))
EgtMove( nFlat, Vector3d(0,0,-dMove)) EgtMove( nFlat, Vector3d(0,0,-dMove))
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT) frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
@@ -172,8 +323,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3) EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- Se mortasa chiusa -- Se mortasa chiusa
if not bOpenBtm then 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 -- 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 then 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' local sErr = 'Error : Mortise from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
@@ -198,7 +349,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId) local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup' local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -236,14 +387,14 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
local sPocketing local sPocketing
if Proc.Prc ~= 53 then if Proc.Prc ~= 53 then
sPocketing = ML.FindPocketing( sPockType..sMchExt, dW) sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown)
if not sPocketing and bPockUp then if not sPocketing and bPockUp then
sPocketing = ML.FindPocketing( sPockType, dW) sPocketing = ML.FindPocketing( sPockType, dW)
end end
end end
if not sPocketing then if not sPocketing then
sPockType = 'Pocket' sPockType = 'Pocket'
sPocketing = ML.FindPocketing( sPockType..sMchExt, dW) sPocketing = ML.FindPocketing( sPockType..sMchExt, dW, nil, nil, not bPockDown, bPockDown)
if not sPocketing and bPockUp then if not sPocketing and bPockUp then
sPocketing = ML.FindPocketing( sPockType, dW) sPocketing = ML.FindPocketing( sPockType, dW)
end end
@@ -286,8 +437,12 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if bPockAngTrasm then if bPockAngTrasm then
nSCC = MCH_SCC.ADIR_NEAR nSCC = MCH_SCC.ADIR_NEAR
elseif not BD.C_SIMM then elseif not BD.C_SIMM then
if vtN:getY() < GEO.EPS_SMALL 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) nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else else
nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP) nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
@@ -321,7 +476,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- imposto elevazione -- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';') EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';')
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -346,11 +501,19 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- sistemo la direzione di lavoro -- sistemo la direzione di lavoro
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
if vtN:getY() < GEO.EPS_SMALL then local nSCC = MCH_SCC.NONE
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) if not BD.C_SIMM then
else if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM) 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 end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- se altezza mortasa differente da altezza massima lavorabile -- se altezza mortasa differente da altezza massima lavorabile
if abs( dMorH - dMaxDepth) > GEO.EPS_SMALL then if abs( dMorH - dMaxDepth) > GEO.EPS_SMALL then
nDepthMin = -dMorH nDepthMin = -dMorH
@@ -362,12 +525,18 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- imposto elevazione -- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1) .. ';') EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1) .. ';')
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
end end
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 return true, sWarn
end end
+169 -111
View File
@@ -1,10 +1,13 @@
-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/01/26 -- ProcessProfCamb.lua by Egaltech s.r.l. 2022/05/28
-- Gestione calcolo profilo caudato per Travi -- Gestione calcolo profilo caudato per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 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/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 Estesa gestione di testa da sotto, se presente.
-- 2021/10/12 Portato a 30deg l'angolo limite per fare l'antischeggia. -- 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/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.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessProfCamb = {} local ProcessProfCamb = {}
@@ -13,6 +16,7 @@ local ProcessProfCamb = {}
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfCamb started', 1) EgtOutLog( ' ProcessProfCamb started', 1)
@@ -62,6 +66,12 @@ function ProcessProfCamb.Classify( Proc, b3Raw)
end end
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) local function GetSawCutData( AuxId, vtNF)
-- comincio con la normale a 45deg -- comincio con la normale a 45deg
@@ -128,7 +138,7 @@ local function ModifySideAndInvert( Proc, bHead, bForceInvert, nCutLengthMach)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, nCutLengthMach) EgtSetMachiningParam( MCH_MP.ENDADDLEN, nCutLengthMach)
end end
-- riapplico la lavorazione -- riapplico la lavorazione
EgtApplyMachining( true, false) ML.ApplyMachining( true, false)
end end
end end
end end
@@ -140,12 +150,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto -- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0 local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then if dDepth > 0.1 then
nChamfer = 1 nChamfer = 1
end end
-- verifico se posso fare solo lo smusso -- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then if nChamfer == 1 then
nChamfer = nChamfer + 1 nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco -- altrimenti se non ho l'affondamento esco
else else
@@ -174,19 +184,15 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
-- recupero la lavorazione -- recupero la lavorazione
local sMilling, sMilling2 local sMilling, sMilling2
if nChamfer > 0 then 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 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') sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead)
if not sMilling then sMilling = ML.FindMilling( 'Mark') end
else
sMilling = ML.FindMilling( 'Mark')
end
if not sMilling then if not sMilling then
local sErr = 'Error : chamfer not found in library' local sErr = 'Error : chamfer not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return -1, 0, sErr return -1, 0, sErr
end end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then 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 if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library' local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -201,6 +207,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -272,28 +279,43 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bMakeAs = true bMakeAs = true
end end
end end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama -- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then 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 ptStart, vtNP = GetSawCutData( AuxId, vtNF)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} -- recupero la lavorazione
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) local sPockType = 'OpenPocket'
if not bOk then return bOk, sErr end 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
-- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama -- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama
-- recupero la lavorazione di fresatura -- recupero la lavorazione di fresatura
local sMillType = 'Prof' local sMillType = 'Prof'
sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', '')) sMilling, _, _, bMillDown = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown)
if not sMilling and bMillDown then
sMilling = ML.FindMilling( sMillType)
bMillDown = false
end
if not sMilling then if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -312,7 +334,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if ( nSide ~= -1 or bMillDown) and nLastFacet and EgtGetInfo( Proc.Id, sEnableExtraBladeUpperFace, 'i') == 1 then if ( nSide ~= -1 or bMillDown) and nLastFacet and EgtGetInfo( Proc.Id, sEnableExtraBladeUpperFace, 'i') == 1 then
-- recupero la lavorazione -- recupero la lavorazione
local sCutType = 'HeadSide' 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 -- se richiesto taglio con lama da sotto e non trovato non posso utilizzare quello da sopra
if not sCutting then if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing not found in library'
@@ -383,7 +405,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -430,7 +452,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -444,9 +466,124 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se il chamfer non è esclusivo continuo con le altre lavorazioni -- se il chamfer non è esclusivo continuo con le altre lavorazioni
if nChamfer < 2 then if nChamfer < 2 then
-- verifico se necessario lavorare in doppio -- 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) 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 local sName
if bMakeAs then if bMakeAs then
sName = 'Prof_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'Prof_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -509,7 +646,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true bFinish = true
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -547,92 +684,13 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
end end
end 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 -- 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 if ( nSide ~= -1 or bMillDown) and EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') == 1 then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -663,7 +721,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false) EgtSetOperationMode( nMchVId, false)
return false, sErr return false, sErr
@@ -685,7 +743,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX()) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end end
end end
return true return true, sWarn
end 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 -- Gestione calcolo profilo concavo per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 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/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 -- Tabella per definizione modulo
local ProcessProfConcave = {} local ProcessProfConcave = {}
@@ -9,6 +12,7 @@ local ProcessProfConcave = {}
-- Include -- Include
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfConcave started', 1) EgtOutLog( ' ProcessProfConcave started', 1)
@@ -55,6 +59,12 @@ function ProcessProfConcave.Classify( Proc, b3Raw)
end end
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) local function GetSawCutData( AuxId, vtN)
-- comincio con la normale a 45deg -- 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 -- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione -- e se è vicino alla parte esterna della trave inverto la lavorazione
ptSP = EgtGetMachiningStartPoint() local ptSP = EgtGetMachiningStartPoint()
ptEp = EgtGetMachiningEndPoint() local ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE) local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) < 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) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end end
-- riapplico la lavorazione -- riapplico la lavorazione
EgtApplyMachining( true, false) ML.ApplyMachining( true, false)
end end
end end
@@ -127,12 +137,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto -- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0 local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then if dDepth > 0.1 then
nChamfer = 1 nChamfer = 1
end end
-- verifico se posso fare solo lo smusso -- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then if nChamfer == 1 then
nChamfer = nChamfer + 1 nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco -- altrimenti se non ho l'affondamento esco
else else
@@ -164,7 +174,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark') sMilling = ML.FindMilling( 'Mark')
if not sMilling then if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 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 end
if not sMilling then if not sMilling then
local sErr = 'Error : chamfer not found in library' local sErr = 'Error : chamfer not found in library'
@@ -173,7 +183,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end end
end end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then 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 if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library' local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -188,6 +198,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -249,19 +260,38 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then if nChamfer < 0 then
return false, sChamfer return false, sChamfer
end end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama -- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then 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 ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} -- recupero la lavorazione
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) local sPockType = 'OpenPocket'
if not bOk then return bOk, sErr end 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
end end
-- se devo inserire il chamfer -- se devo inserire il chamfer
@@ -321,7 +351,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -371,7 +401,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -404,9 +434,111 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- verifico se necessario lavorare in doppio -- 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) 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 sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling) local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then if not nMchId then
@@ -458,9 +590,10 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end end
-- posizione braccio porta testa -- 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 -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -470,7 +603,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true bFinish = true
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -484,7 +617,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if bFinish then if bFinish then
-- inserisco la lavorazione -- inserisco la lavorazione
local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) 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 if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -494,80 +627,17 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
end end
end 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 -- 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) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and 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)) sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchVId = EgtAddMachining( sName, sMilling) local nMchVId = EgtAddMachining( sName, sMilling)
if not nMchVId then 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.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false) EgtSetOperationMode( nMchVId, false)
return false, sErr 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 -- 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) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and 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)) sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchV2Id = EgtAddMachining( sName, sMilling) local nMchV2Id = EgtAddMachining( sName, sMilling)
if not nMchV2Id then if not nMchV2Id then
@@ -626,8 +697,9 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false) EgtSetOperationMode( nMchV2Id, false)
return false, sErr 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()) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end end
end end
return true return true, sWarn
end 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 -- Gestione calcolo profilo convesso per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 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/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 -- Tabella per definizione modulo
local ProcessProfConvex = {} local ProcessProfConvex = {}
@@ -9,6 +12,7 @@ local ProcessProfConvex = {}
-- Include -- Include
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfConvex started', 1) EgtOutLog( ' ProcessProfConvex started', 1)
@@ -55,6 +59,12 @@ function ProcessProfConvex.Classify( Proc, b3Raw)
end end
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) local function GetSawCutData( AuxId, vtN)
-- comincio con la normale a 45deg -- 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 -- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione -- e se è vicino alla parte esterna della trave inverto la lavorazione
ptSP = EgtGetMachiningStartPoint() local ptSP = EgtGetMachiningStartPoint()
ptEp = EgtGetMachiningEndPoint() local ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE) local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) < 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) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end end
-- riapplico la lavorazione -- riapplico la lavorazione
EgtApplyMachining( true, false) ML.ApplyMachining( true, false)
end end
end end
@@ -127,12 +137,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto -- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0 local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then if dDepth > 0.1 then
nChamfer = 1 nChamfer = 1
end end
-- verifico se posso fare solo lo smusso -- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then if nChamfer == 1 then
nChamfer = nChamfer + 1 nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco -- altrimenti se non ho l'affondamento esco
else else
@@ -164,7 +174,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark') sMilling = ML.FindMilling( 'Mark')
if not sMilling then if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 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 end
if not sMilling then if not sMilling then
local sErr = 'Error : chamfer not found in library' local sErr = 'Error : chamfer not found in library'
@@ -173,7 +183,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end end
end end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then 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 if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library' local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -188,6 +198,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -249,19 +260,38 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then if nChamfer < 0 then
return false, sChamfer return false, sChamfer
end end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama -- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then 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 ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} -- recupero la lavorazione
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) local sPockType = 'OpenPocket'
if not bOk then return bOk, sErr end 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
end end
-- se devo inserire il chamfer -- se devo inserire il chamfer
@@ -321,7 +351,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -371,7 +401,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -404,9 +434,111 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- verifico se necessario lavorare in doppio -- 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) 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 sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling) local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then if not nMchId then
@@ -458,9 +590,10 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end end
-- posizione braccio porta testa -- 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 -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -470,7 +603,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true bFinish = true
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -494,80 +627,17 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
end end
end 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 -- 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) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and 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)) sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchVId = EgtAddMachining( sName, sMilling) local nMchVId = EgtAddMachining( sName, sMilling)
if not nMchVId then 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.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false) EgtSetOperationMode( nMchVId, false)
return false, sErr 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 -- 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) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and 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)) sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchV2Id = EgtAddMachining( sName, sMilling) local nMchV2Id = EgtAddMachining( sName, sMilling)
if not nMchV2Id then if not nMchV2Id then
@@ -626,8 +697,9 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false) EgtSetOperationMode( nMchV2Id, false)
return false, sErr return false, sErr
@@ -635,12 +707,13 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- aggiorno ingombro testa o coda per presa -- 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 if bHead then
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMin():getX()) BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMin():getX())
else else
BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX()) BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX())
end end
-- altrimenti feature da sopra
else else
if bHead then if bHead then
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMax():getX()) 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()) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end end
end end
return true return true, sWarn
end 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 -- Gestione calcolo profilo frontale per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto. -- 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/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 -- Tabella per definizione modulo
local ProcessProfFront = {} local ProcessProfFront = {}
@@ -9,6 +12,7 @@ local ProcessProfFront = {}
-- Include -- Include
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfFront started', 1) EgtOutLog( ' ProcessProfFront started', 1)
@@ -55,6 +59,12 @@ function ProcessProfFront.Classify( Proc, b3Raw)
end end
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 function GetSawCutData( AuxId, vtN)
local vtNP = Vector3d( vtN) local vtNP = Vector3d( vtN)
@@ -87,7 +97,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam)
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT) local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode) EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
-- riapplico la lavorazione -- riapplico la lavorazione
EgtApplyMachining( true, false) ML.ApplyMachining( true, false)
end end
end end
end end
@@ -99,12 +109,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto -- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0 local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then if dDepth > 0.1 then
nChamfer = 1 nChamfer = 1
end end
-- verifico se posso fare solo lo smusso -- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then if nChamfer == 1 then
nChamfer = nChamfer + 1 nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco -- altrimenti se non ho l'affondamento esco
else else
@@ -136,7 +146,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark') sMilling = ML.FindMilling( 'Mark')
if not sMilling then if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 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 end
if not sMilling then if not sMilling then
local sErr = 'Error : chamfer not found in library' local sErr = 'Error : chamfer not found in library'
@@ -145,7 +155,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end end
end end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then 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 if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library' local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -160,6 +170,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -220,19 +231,38 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then if nChamfer < 0 then
return false, sChamfer return false, sChamfer
end end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama -- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then 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 ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} -- recupero la lavorazione
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) local sPockType = 'OpenPocket'
if not bOk then return bOk, sErr end 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
end end
-- se devo inserire il chamfer -- se devo inserire il chamfer
@@ -282,7 +312,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -330,7 +360,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -363,8 +393,104 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- verifico se necessario lavorare in doppio -- 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) 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 -- inserisco la lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling) local nMchId = EgtAddMachining( sName, sMilling)
@@ -413,7 +539,6 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) 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 -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -423,7 +548,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true bFinish = true
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -447,77 +572,17 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
end end
end 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 -- 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) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and 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 -- se non da sotto, inserisco lavorazione finitura angolo
--if nSide ~= -1 then --if nSide ~= -1 then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) 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)) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
-- imposto tipo uso faccia -- imposto tipo uso faccia
local nFaceUse = MCH_MILL_FU.PARAL_DOWN 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) nFaceUse = EgtIf( vtN:getY() > 0.1, MCH_MILL_FU.PARAL_FRONT, MCH_MILL_FU.PARAL_BACK)
end end
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
@@ -551,7 +618,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false) EgtSetOperationMode( nMchVId, false)
return false, sErr 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()) -- BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX())
-- end -- end
--end --end
return true return true, sWarn
end 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 -- Gestione calcolo profilo di testa per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa sotto. -- 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/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 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 -- Tabella per definizione modulo
local ProcessProfHead = {} local ProcessProfHead = {}
@@ -10,6 +13,7 @@ local ProcessProfHead = {}
-- Include -- Include
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfHead started', 1) EgtOutLog( ' ProcessProfHead started', 1)
@@ -56,6 +60,12 @@ function ProcessProfHead.Classify( Proc, b3Raw)
end end
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) local function GetSawCutData( AuxId, vtN)
-- assegno la normale -- 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 -- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione -- e se è vicino alla parte esterna della trave inverto la lavorazione
ptSP = EgtGetMachiningStartPoint() local ptSP = EgtGetMachiningStartPoint()
ptEp = EgtGetMachiningEndPoint() local ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE) local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) < 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) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end end
-- riapplico la lavorazione -- riapplico la lavorazione
EgtApplyMachining( true, false) ML.ApplyMachining( true, false)
end end
end end
@@ -120,12 +130,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto -- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0 local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then if dDepth > 0.1 then
nChamfer = 1 nChamfer = 1
end end
-- verifico se posso fare solo lo smusso -- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then if nChamfer == 1 then
nChamfer = nChamfer + 1 nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco -- altrimenti se non ho l'affondamento esco
else else
@@ -154,19 +164,15 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
-- recupero la lavorazione -- recupero la lavorazione
local sMilling, sMilling2 local sMilling, sMilling2
if nChamfer > 0 then 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 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') sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead)
if not sMilling then sMilling = ML.FindMilling( 'Mark') end
else
sMilling = ML.FindMilling( 'Mark')
end
if not sMilling then if not sMilling then
local sErr = 'Error : chamfer not found in library' local sErr = 'Error : chamfer not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return -1, 0, sErr return -1, 0, sErr
end end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then 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 if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library' local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -256,19 +262,38 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then if nChamfer < 0 then
return false, sChamfer return false, sChamfer
end end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama -- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then 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 ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} -- recupero la lavorazione
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH) local sPockType = 'OpenPocket'
if not bOk then return bOk, sErr end 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
end end
-- se devo inserire il chamfer -- se devo inserire il chamfer
@@ -328,7 +353,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -380,7 +405,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -396,10 +421,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 2 then if nChamfer < 2 then
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Prof' local sMillType = 'Prof'
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', '')) local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown)
if not sMilling then
sMilling = ML.FindMilling( sMillType)
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -418,9 +440,108 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- verifico se necessario lavorare in doppio -- 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) 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 sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling) local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then if not nMchId then
@@ -474,7 +595,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) 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 -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0 local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -484,7 +604,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true bFinish = true
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -509,77 +629,13 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset) EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat) EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false) EgtSetOperationMode( nMch2Id, false)
return false, sErr return false, sErr
end end
end 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 -- 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) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and #vAngs > 0 then if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and #vAngs > 0 then
@@ -618,7 +674,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false) EgtSetOperationMode( nMchV2Id, false)
return false, sErr return false, sErr
@@ -658,7 +714,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false) EgtSetOperationMode( nMchVId, false)
return false, sErr 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()) BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end end
end end
return true return true, sWarn
end 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 -- determino se da lavorare con testa da sotto
local bDownHead = ( BD.DOWN_HEAD and vtN[vFaceOrd[3]]:getZ() < -0.1) local bDownHead = ( BD.DOWN_HEAD and vtN[vFaceOrd[3]]:getZ() < -0.1)
-- recupero la lavorazione -- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bDownHead, '_H2', '')) local sCutting = ML.FindCutting( 'HeadSide', not bDownHead, bDownHead)
if not sCutting then if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -137,23 +137,22 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
end 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 -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {} local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then 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 end
if #vCuts > 0 then 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 -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end 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) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr 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 -- 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 -- Tabella per definizione modulo
local ProcessSawCut = {} local ProcessSawCut = {}
@@ -31,12 +32,14 @@ function ProcessSawCut.Classify( Proc, b3Raw)
if not AuxId then return false end if not AuxId then return false end
AuxId = AuxId + Proc.Id AuxId = AuxId + Proc.Id
local vtDir = EgtSV( AuxId, GDB_ID.ROOT) local vtDir = EgtSV( AuxId, GDB_ID.ROOT)
return true, ( vtDir:getZ() <= - 0.088) return true, ( vtDir:getZ() <= - 0.5)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- 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 -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -71,7 +74,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- altrimenti taglio di coda -- altrimenti taglio di coda
else else
-- se coincide con taglio di separazione, non va fatto -- 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 return true
end end
end end
@@ -181,6 +184,9 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
for i = 1, nC do for i = 1, nC do
-- Posizione braccio portatesta -- Posizione braccio portatesta
local nSCC = EgtIf( ( BD.C_SIMM or i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) 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 -- ciclo sulle passate
local dOffset = dWidth - dDepth ; local dOffset = dWidth - dDepth ;
local dLioTang = 0 local dLioTang = 0
@@ -219,7 +225,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- imposto uso della faccia -- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
+29 -15
View File
@@ -1,6 +1,8 @@
-- ProcessScarfJoint.lua by Egaltech s.r.l. 2021/06/28 -- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/07/12
-- Gestione calcolo giunto Gerber per Travi -- Gestione calcolo giunto Gerber per Travi
-- 2021/06/28 Aggiunto extra-taglio alle lamate orizzontali. -- 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 -- Tabella per definizione modulo
local ProcessScarfJoint = {} local ProcessScarfJoint = {}
@@ -26,6 +28,10 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function ProcessScarfJoint.Classify( Proc) 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 -- verifico le normali delle facce
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id) local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
for i = 1, nFacetCnt do for i = 1, nFacetCnt do
@@ -92,7 +98,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -115,7 +121,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr 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 function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
local vCuts = {}
local bOk = true local bOk = true
local sErr = '' local sErr = ''
local vCuts = {}
if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then
-- lavoro solo la faccia inclinata perché la faccia tappo completa la lavoro successivamente -- lavoro solo la faccia inclinata perché la faccia tappo completa la lavoro successivamente
-- questo evita di lavorare due volte la faccia tappo -- 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) vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[4]], vtN[vFaceOrd[4]], true, nil, nil, nil, dNewDiceDim)
end end
local dVzLimDwnUp = EgtIf( vtRef:getZ() < -0.017, -2, nil)
if #vCuts > 0 then if #vCuts > 0 then
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
@@ -173,7 +181,7 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
local dExtraCut = EgtIf( i % 2 == 1, 0, BD.CUT_EXTRA) local dExtraCut = EgtIf( i % 2 == 1, 0, BD.CUT_EXTRA)
-- lavoro la faccia -- lavoro la faccia
for j = 1, #vCuts[i] do 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 if not bOk then return bOk, sErr end
end end
end end
@@ -181,14 +189,14 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
if vFaceOrd[1] ~= 0 then if vFaceOrd[1] ~= 0 then
-- inserisco la lavorazione -- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef) 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 if not bOk then return bOk, sErr end
end end
-- lavoro la faccia opposta (definita dal parametro P11) -- lavoro la faccia opposta (definita dal parametro P11)
if vFaceOrd[3] ~= 0 then if vFaceOrd[3] ~= 0 then
-- inserisco la lavorazione -- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef) 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 if not bOk then return bOk, sErr end
end end
end end
@@ -198,7 +206,9 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- 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 -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -287,8 +297,12 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end 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 -- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide') local sCutting = ML.FindCutting( 'HeadSide', bTopHead, bDownHead)
if not sCutting then if not sCutting then
local sErr = 'Error : cutting not found in library' local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -401,7 +415,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- 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 bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
@@ -438,9 +452,9 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la lavorazione. considerando l dimensione del lato e l'affondamento -- recupero la lavorazione. considerando l dimensione del lato e l'affondamento
local sPocketing local sPocketing
if dDistFaces then if dDistFaces then
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, dDistFaces) sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, dDistFaces, nil, bTopHead, bDownHead)
else else
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax) sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, nil, nil, bTopHead, bDownHead)
end end
if not sPocketing then if not sPocketing then
@@ -473,7 +487,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDistFaces, 1) .. ';') EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDistFaces, 1) .. ';')
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -486,20 +500,20 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if abs( vtRef:getZ()) > 0.1 then if abs( vtRef:getZ()) > 0.1 then
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD) local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
dHCI = 0.75 * dHCI
else else
dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
end end
dHCI = 0.75 * dHCI
BL.UpdateHCING( nRawId, dHCI) BL.UpdateHCING( nRawId, dHCI)
elseif Proc.Tail then elseif Proc.Tail then
local dTCI = 0 local dTCI = 0
if abs( vtRef:getZ()) > 0.1 then if abs( vtRef:getZ()) > 0.1 then
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD) local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
dTCI = 0.75 * dTCI
else else
dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX() dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
end end
dTCI = 0.75 * dTCI
BL.UpdateTCING( nRawId, dTCI) BL.UpdateTCING( nRawId, dTCI)
end end
+21 -18
View File
@@ -1,5 +1,7 @@
-- ProcessSimpleScarf.lua by Egaltech s.r.l. 2020/06/04 -- ProcessSimpleScarf.lua by Egaltech s.r.l. 2020/06/04
-- Gestione calcolo giunto Gerber per Travi -- 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.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessSimpleScarf = {} local ProcessSimpleScarf = {}
@@ -9,6 +11,7 @@ require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local DC = require( 'DiceCut') local DC = require( 'DiceCut')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessSimpleScarf started', 1) EgtOutLog( ' ProcessSimpleScarf started', 1)
@@ -91,7 +94,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -114,7 +117,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -124,7 +127,9 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- 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 -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo -- ingombro del pezzo
@@ -135,12 +140,11 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end 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) local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
if nFacetCnt < 2 then if nFacetCnt < 2 then
local sErr = 'Error : number of faces not enough' local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, nil, nil, nil, dOvmTail)
EgtOutLog( sErr) return bOk, sErr
return false, sErr
end end
-- dati delle facce -- dati delle facce
local ptC = {} local ptC = {}
@@ -208,7 +212,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- 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 bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
@@ -218,25 +222,24 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOk then return bOk, sNameOrErr end if not bOk then return bOk, sNameOrErr end
end 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 -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {} local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then 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 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 end
if #vCuts > 0 then 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 e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
+226 -24
View File
@@ -1,5 +1,8 @@
-- 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 -- 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.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessSplit = {} local ProcessSplit = {}
@@ -8,6 +11,8 @@ local ProcessSplit = {}
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
EgtOutLog( ' ProcessSplit started', 1) EgtOutLog( ' ProcessSplit started', 1)
@@ -109,7 +114,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -132,7 +137,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -140,9 +145,97 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
return true, nil return true, nil
end 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 -- 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 -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- inserimento smussi -- inserimento smussi
@@ -169,11 +262,25 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
end end
end end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) 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
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
end
end
-- caratteristiche taglio -- 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, abs( BD.MAX_DIM_HTCUT_HBEAM))
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM) local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) ( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * 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) local bHorizCut = ( not bBigSectionCut and ( 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 bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
-- dati geometrici del taglio -- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- flag di lavorazione faccia -- flag di lavorazione faccia
@@ -195,8 +302,111 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
b3Raw:Add( b3NextRaw) b3Raw:Add( b3NextRaw)
end end
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
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
-- se finitura con lama
if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 or not bSplit then
local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dLenEndRaw, nil, false, true, b3Raw, sNotes, dCurrOvmT)
if not bOk then return bOk, sErr, nNewPhase end
-- se finitura con truciolatore
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 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 not bOk then return bOk, sErr, nNewPhase end
end
if sNotesFinal then
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
end
end
-- se tagli standard -- se tagli standard
if not bDoubleHorizCut then elseif not bDoubleHorizCut then
-- calcolo extra taglio ed accorciamento -- calcolo extra taglio ed accorciamento
local dCutExtra = 0 local dCutExtra = 0
local dAccStart = 0 local dAccStart = 0
@@ -236,23 +446,12 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
end end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna -- altrimenti necessari tagli da sopra e sotto con testa opportuna
else else
-- recupero la lavorazione con lama da sotto -- verifico esistenza della lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2')
if not sCutting2 then if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library' local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end 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 -- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ() local dDimZ = b3Raw:getDimZ()
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
@@ -265,11 +464,14 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0 local dAccStart = 0
-- limiti da sotto
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- eseguo i tagli da sotto necessari -- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL local dCutOffset = ( i - 1) * dOffsL
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;') 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 if not bOk then return false, sErr end
end end
-- eseguo i tagli da sopra necessari -- eseguo i tagli da sopra necessari
@@ -281,11 +483,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
else else
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
end 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 if not bOk then return false, sErr end
end end
end end
return true return true, nil, nNewPhase
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
+14 -26
View File
@@ -83,11 +83,8 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Mark' local sMillType = 'Mark'
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1) local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', '')) local sMilling
if not sMilling and bDownHead then sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
sMilling = ML.FindMilling( sMillType)
bDownHead = false
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -109,7 +106,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -132,7 +129,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -191,15 +188,15 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end 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 convesso, lo tratto come due tagli singoli -- se convesso, lo tratto come due tagli singoli
if bConvex then 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 -- lavoro per prima la faccia più diretta in alto
local vOrd = { 1, 2} local vOrd = { 1, 2}
if vtN[2]:getZ() > vtN[1]:getZ() then if vtN[2]:getZ() > vtN[1]:getZ() then
@@ -247,20 +244,12 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end end
-- verifico se necessari tagli supplementari -- 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) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then 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 e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
@@ -383,7 +372,6 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end end
end end
-- Taglio la faccia 2
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId) local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then if not nAddGrpId then
@@ -391,6 +379,7 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- Taglio la faccia 2
-- creo piano di taglio coincidente con la faccia 2 e lo lavoro -- creo piano di taglio coincidente con la faccia 2 e lo lavoro
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptC[3], vtN[3], b3Solid, GDB_RT.GLOB) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptC[3], vtN[3], b3Solid, GDB_RT.GLOB)
if AddId then if AddId then
@@ -409,13 +398,12 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end end
-- verifico se necessari tagli supplementari -- 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) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then if #vCuts > 0 then
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
+19 -33
View File
@@ -57,11 +57,8 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid,
local bDownHead = ( BD.DOWN_HEAD and vtN[nBigInd]:getZ() < -0.5) local bDownHead = ( BD.DOWN_HEAD and vtN[nBigInd]:getZ() < -0.5)
-- recupero la lavorazione -- recupero la lavorazione
local sCutType = 'HeadSide' local sCutType = 'HeadSide'
local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', '')) local sCutting
if not sCutting and bTopHead then sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead)
sCutting = ML.FindCutting( sCutType)
bDownHead = false
end
if not sCutting then if not sCutting then
local sErr = 'Error : cutting not found in library' local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -84,21 +81,20 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid,
if dAng < -90.5 and dAng > -179.5 then if dAng < -90.5 and dAng > -179.5 then
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
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
-- verifico se necessari tagli supplementari -- 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) --DC.PrintOrderCut( vCuts)
if #vCuts > 0 then 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 e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
@@ -162,11 +158,7 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
local bTopHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() > -0.1) local bTopHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() > -0.1)
local bDownHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() < 0.1) local bDownHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() < 0.1)
-- recupero la lavorazione -- recupero la lavorazione
local sPocketing = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic) local sPocketing, _, _, bDownHead = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic, nil, bTopHead, bDownHead)
if not sPocketing and bTopHead then
sPocketing = ML.FindPocketing( sMchFind, dDiamTool, dElev + dCollSic)
bDownHead = false
end
if not sPocketing then if not sPocketing then
local sErr = 'Error : pocketing not found in library' local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -202,10 +194,10 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
-- imposto elevazione -- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca -- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -271,10 +263,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
-- scelta lavorazione -- scelta lavorazione
local sMilling local sMilling
local sTypeMill = EgtIf( nUseRoughTool > 0, 'Long2Cut', 'LongSmallCut') local sTypeMill = EgtIf( nUseRoughTool > 0, 'Long2Cut', 'LongSmallCut')
sMilling = ML.FindMilling( sTypeMill .. EgtIf( bDownHead, '_H2', ''), nil, sTuuidMstr) sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr, nil, nil, bTopHead, bDownHead)
if not sMilling and bTopHead then
sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr)
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -319,7 +308,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
EgtSetMachiningParam( MCH_MP.LIPERP, 20) EgtSetMachiningParam( MCH_MP.LIPERP, 20)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI) EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
@@ -534,11 +523,8 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Mark' local sMillType = 'Mark'
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1) local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', '')) local sMilling
if not sMilling and bDownHead then sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
sMilling = ML.FindMilling( sMillType)
bDownHead = false
end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -561,7 +547,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -586,7 +572,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro -- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
+33 -82
View File
@@ -1,6 +1,9 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2021/10/04 -- ProcessTenon.lua by Egaltech s.r.l. 2022/05/28
-- Gestione calcolo tenone per Travi -- Gestione calcolo tenone per Travi
-- 2021/10/04 Corretto calcolo HCING per pezzi piccoli. -- 2021/10/04 Corretto calcolo HCING per pezzi piccoli.
-- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto.
-- 2022/05/18 Migliorata gestione attacco.
-- 2022/05/28 Spostato calcolo svuotatura in modulo di libreria.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessTenon = {} local ProcessTenon = {}
@@ -8,6 +11,7 @@ local ProcessTenon = {}
-- Include -- Include
require( 'EgtBase') require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut') local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessTenon started', 1) EgtOutLog( ' ProcessTenon started', 1)
@@ -19,6 +23,10 @@ local ML = require( 'MachiningLib')
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function VerifyOrientation( Proc, vtN, b3Raw) 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 -- se trave molto bassa
if b3Raw:getDimZ() <= 120 then if b3Raw:getDimZ() <= 120 then
-- se tenone praticamente in asse, accetto fino a -45 deg -- se tenone praticamente in asse, accetto fino a -45 deg
@@ -73,41 +81,6 @@ function ProcessTenon.Classify( Proc, b3Raw)
return true, bDown return true, bDown
end 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 -- Applicazione della lavorazione
function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
@@ -155,8 +128,6 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- abilitazione lavorazione da sotto -- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259) local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1) 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 -- se vero tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
if Proc.Prc ~= 52 and if Proc.Prc ~= 52 and
( not AreSameOrOppositeVectorApprox( vtN, X_AX()) or ( not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
@@ -176,43 +147,16 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId) EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura -- 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 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 sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket')
local sPocketing = ML.FindPocketing( sPockType) local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, not bMillDown, bMillDown)
local dMaxDepth = 100 if not sPocketing then
local dStep = 30 local sErr = 'Error : pocketing '..sPockType..' not found in library'
local nSurfStep EgtOutLog( sErr)
-- 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
return false, sErr return false, sErr
end end
-- faccio ultima superfice -- eseguo le svuotature necessarie
bOk, sErr = ApplyPocket( Proc, sPocketing, 1, EgtIf( nSurfStep > 1, ( dSurfStep + 0), 0), AddId, vtExtr) local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then if not bOk then
return false, sErr return false, sErr
end end
@@ -223,16 +167,17 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId} Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bFromBottom = ( bShortPart and vtExtr:getZ() > 0.25) local bFromBottom = ( bShortPart and vtExtr:getZ() > 0.25)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom) 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 end
end end
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Tenon' local sMillType = 'Tenon'
local sCurrType = sMillType .. EgtIf( bMillDown, '_H2', '') local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown)
local sMilling = ML.FindMilling( sCurrType, dTenH) or ML.FindMilling( sCurrType) if not sMilling then
if not sMilling and bMillUp then sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
sMilling = ML.FindMilling( sMillType, dTenH) or ML.FindMilling( sMillType)
end end
if not sMilling then if not sMilling then
local sErr = 'Error : milling not found in library' local sErr = 'Error : milling not found in library'
@@ -252,6 +197,13 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCW = ( dSpeed >= 0) bCW = ( dSpeed >= 0)
end end
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 abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259)
BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, bH2 ~= bMyShortPart)
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente -- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
local sWarn local sWarn
local dDepth = 0 local dDepth = 0
@@ -262,9 +214,8 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')') EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
end end
-- determino il numero di passate concentriche (max 6) -- determino il numero di passate concentriche (max 6)
local MAX_PASS = 6 local nPass = min( ceil( dPockL / ( OVERLAP_COEFF * dMillDiam)), MAX_PASS)
local nPass = min( ceil( dPockL / ( 0.7 * dMillDiam)), MAX_PASS) local dStep = min( dPockL, OVERLAP_COEFF * dMillDiam * MAX_PASS) / nPass
local dStep = min( dPockL, 0.7 * dMillDiam * MAX_PASS) / nPass
for i = nPass, 1, -1 do for i = nPass, 1, -1 do
-- inserisco la passata finale della lavorazione -- inserisco la passata finale della lavorazione
local sNameF = 'TenF_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sNameF = 'TenF_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -293,7 +244,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE 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 nSCC = MCH_SCC.ADIR_YM
if abs( vtExtr:getY()) > 0.088 then if abs( vtExtr:getY()) > 0.088 then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
@@ -301,7 +252,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr return false, sErr
+4 -7
View File
@@ -46,7 +46,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
return false, sErr return false, sErr
end end
-- verifico che il testo non sia orientato verso il basso (-5 deg) -- 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' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Text from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, 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) local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174)
-- recupero la lavorazione -- recupero la lavorazione
local sMillType = 'Text' local sMillType = 'Text'
local sMchExt = EgtIf( bMillDown, '_H2', '') --local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType..sMchExt) local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
if not sMilling then if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -83,7 +80,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
return false, sErr 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 -- 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 -- Tabella per definizione modulo
local ProcessTyroleanDovetail = {} 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 -- 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) -- 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 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 end
end end
@@ -136,7 +142,7 @@ local function EvaluateQParam( Proc, sDephtCham)
end 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 -- dati delle facce
local ptC = {} local ptC = {}
@@ -203,7 +209,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId) local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup' local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -219,7 +225,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- 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 bCut = false
end end
-- se va fatto, inserisco la lavorazione -- 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 -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {} local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then 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 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 end
if #vCuts > 0 then if #vCuts > 0 then
-- sistemo posizione nel DB e nome -- sistemo posizione nel DB e nome
for i = 1, #vCuts do for i = 1, #vCuts do
for j = 1, #vCuts[i] do for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end end
@@ -318,7 +323,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
bCut = false bCut = false
end end
-- se di coda e coincide con taglio di separazione, non va fatto -- 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 bCut = false
end end
-- se va fatto, inserisco la lavorazione -- se va fatto, inserisco la lavorazione
@@ -452,7 +457,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling, nFacInd, TabNAD, rfFac, dOf
end end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)
return false, sErr return false, sErr
@@ -472,7 +477,7 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId) local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup' local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
@@ -667,7 +672,9 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- 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 -- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- in base al tipo di feature attribuisco il significato dei parametri Q -- 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 end
-- se ho due facce allora è di testa -- se ho due facce allora è di testa
if nFacetCnt == 2 then 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 if not bOk then return bOk, sErr end
else else
local bOk, sErr = MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt) local bOk, sErr = MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
+142 -32
View File
@@ -1,5 +1,5 @@
-- BeamNestProcess.lua by Egaltech s.r.l. 2021/06/14 -- BeamNestProcess.lua by Egaltech s.r.l. 2021/06/14
-- Gestione nesting automatico pareti -- Gestione nesting automatico travi
-- Intestazioni -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -114,9 +114,24 @@ local function NewMachGroupName()
return nMaxMachGroup + 1 return nMaxMachGroup + 1
end 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 -- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir() EgtAddToPackagePath( NEST.BASEDIR .. '\\LuaLibs\\?.lua')
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi -- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi
EgtSetCurrMachine( NEST.MACHINE) EgtSetCurrMachine( NEST.MACHINE)
@@ -133,21 +148,22 @@ end
EgtRemoveBaseMachineDirFromPackagePath() EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua') 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 -- Inizializzo contatori errori e avvisi
local nErrCnt = 0 local nErrCnt = 0
local nWarnCnt = 0 local nWarnCnt = 0
-- Grezzi -- Grezzi
local Raws = { LenToFill = LEN["1"], StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1, Count = QTY["1"]} -- lista dei grezzi
local nTotRaws = Raws.Count 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 -- Pezzi
local Parts = {} local Parts = {}
@@ -156,50 +172,143 @@ local Parts = {}
for nPartId, nCount in pairs( PART) do for nPartId, nCount in pairs( PART) do
-- recupero lunghezza pezzo -- recupero lunghezza pezzo
local Len = EgtGetInfo( nPartId, "L", 'd') local Len = EgtGetInfo( nPartId, "L", 'd')
local DispLen = EgtIf( Len < 1000, 2000, 0) local DispLen = EgtIf( Len <= 1000, 2000, 0) --EgtIf( Len <= 2000, max( 2000, 6000 - Len), 0)
table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = nCount}) 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 = fmod( ShortCount, MediumRawQty)
-- 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 -- Ciclo fino ad esaurimento pezzi o barre
local nRawTot = 0 local nRawTot = 0
local dTime = 0 local dTime = 0
while Raws.Count > 0 and PartsToFill( Parts) > 0 do local nCycle = 1
-- Eseguo ottimizzazione per una barra e visualizzo il risultato while TotRawCount( Raws) > 0 and PartsToFill( Parts) > 0 do
local Res = ExecMaximumFilling( Raws, Parts)
-- 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 -- 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 -- creo gruppo di lavorazione
local MachGroupName = NewMachGroupName() local MachGroupName = NewMachGroupName()
nMachGroup = EgtAddMachGroup( MachGroupName) nMachGroup = EgtAddMachGroup( MachGroupName)
EgtSetInfo( nMachGroup, "BARLEN", Raws.LenToFill) EgtSetInfo( nMachGroup, "BARLEN", Raws[nMinWasteRawIndex].LenToFill)
EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL) EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL)
EgtSetInfo( nMachGroup, "AUTONEST", 1) EgtSetInfo( nMachGroup, "AUTONEST", 1)
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione -- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID) EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
EgtSetInfo( nMachGroup, "PATTID", nMachGroup) EgtSetInfo( nMachGroup, "PATTID", nMachGroup)
-- Disegno i pezzi -- Disegno i pezzi
local CurrX = Raws.StartGap local CurrX = Raws[nMinWasteRawIndex].StartGap
local nInfoIndex = 1 local nInfoIndex = 1
for i = 1, Res.DiffParts do for i = 1, Results[nMinWasteRawIndex].DiffParts do
local PartIndex = Res.Data[i].Id local PartIndex = Results[nMinWasteRawIndex].Data[i].Id
local PartId = Parts[PartIndex].Id local PartId = PartsToNest[PartIndex].Id
local dLen = Parts[PartIndex].Len local dLen = PartsToNest[PartIndex].Len
for j = 1, Res.Data[i].Count do for j = 1, Results[nMinWasteRawIndex].Data[i].Count do
-- creo pezzo copia -- creo pezzo copia
local nPartDuploId = EgtDuploNew( PartId) local nPartDuploId = EgtDuploNew( PartId)
EgtSetInfo( nMachGroup, "PART" .. nInfoIndex, nPartDuploId .. "," .. CurrX) EgtSetInfo( nMachGroup, "PART" .. nInfoIndex, nPartDuploId .. "," .. CurrX)
CurrX = CurrX + dLen + Raws.MidGap CurrX = CurrX + dLen + Raws[nMinWasteRawIndex].MidGap
nInfoIndex = nInfoIndex + 1 nInfoIndex = nInfoIndex + 1
end end
end end
nRawTot = nRawTot + 1 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 end
-- Aggiorno per prossima iterazione nCycle = nCycle + 1
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
end end
-- creo grezzi per ogni gruppo di lavorazione -- creo grezzi per ogni gruppo di lavorazione
@@ -208,6 +317,7 @@ _G.BEAM = {}
BEAM.FILE = NEST.FILE BEAM.FILE = NEST.FILE
BEAM.MACHINE = NEST.MACHINE BEAM.MACHINE = NEST.MACHINE
BEAM.FLAG = 6 -- CREATE_PANEL BEAM.FLAG = 6 -- CREATE_PANEL
BEAM.BASEDIR = NEST.BASEDIR
nMachGroup = EgtGetFirstMachGroup() nMachGroup = EgtGetFirstMachGroup()
while nMachGroup do while nMachGroup do
local nNextMachGroup = EgtGetNextMachGroup( nMachGroup) local nNextMachGroup = EgtGetNextMachGroup( nMachGroup)
+1 -2
View File
@@ -11,8 +11,7 @@ _ENV = EgtProtectGlobal()
EgtEnableDebug( false) EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Travi -- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir() EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi -- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
local sMachDir = EgtGetCurrMachineDir() local sMachDir = EgtGetCurrMachineDir()