Compare commits

...

205 Commits

Author SHA1 Message Date
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 9417 additions and 2455 deletions
+6
View File
@@ -16,3 +16,9 @@
/bin
/obj
/.vs
/32/*.lua
/32/LuaLibs/*.lua
/32/Images/*.png
/64/*.lua
/64/LuaLibs/*.lua
/64/Images/*.png
+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
+20 -5
View File
@@ -1,4 +1,4 @@
-- BatchProcess.lua by Egaltech s.r.l. 2021/08/04
-- BatchProcess.lua by Egaltech s.r.l. 2022/04/28
-- Gestione calcolo batch disposizione e lavorazioni per Travi
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
-- 2019/07/16 Aggiunta gestione modalità oltre 10 per impostazione macchina e uscita.
@@ -22,6 +22,7 @@
-- 2021/02/25 Aggiunta gestione tipo scarico (standard, lav. incomplete, a caduta).
-- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN.
-- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste.
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
-- Intestazioni
require( 'EgtBase')
@@ -116,8 +117,7 @@ local function UpdateAuxData( sAuxFile)
end
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
-- Impostazione della macchina corrente
EgtResetCurrMachGroup()
@@ -469,6 +469,20 @@ end
-- *** Eseguo simulazione con verifica collisione in cieco ***
if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Simulating with collision check >>>')
-- verifico setup
local bSetUpOk, SetUpErrors = EgtVerifyCurrSetup()
if not bSetUpOk then
local sToolsList = ""
for ToolIndex = 1, #SetUpErrors do
sToolsList = sToolsList .. SetUpErrors[ToolIndex]
if ToolIndex ~= #SetUpErrors then
sToolsList = sToolsList .. ", "
end
end
WriteErrToLogFile( 19, 'Error in setup: tool/s ' .. sToolsList .. ' not found', 0, 0, 0)
return
end
-- lancio simulazione
local bSimOk, nErr, sErr = EgtSimulate()
if not bSimOk then
if nErr == MCH_SHE.INIT then
@@ -507,10 +521,11 @@ end
-- *** Genero programma CN *** ( se richiesto)
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5 - '
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
if EgtGetExeVersion then
sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - '
sInfo = sInfo .. ' ver.' .. EgtGetExeVersion()
end
sInfo = sInfo .. ' - '
if not EgtGenerate( '', sInfo .. sNgeFile) then
BEAM.ERR = 20
local _, sName, _ = EgtSplitPath( BEAM.FILE)
+65 -46
View File
@@ -1,4 +1,4 @@
-- BatchProcessNew.lua by Egaltech s.r.l. 2022/01/07
-- BatchProcessNew.lua by Egaltech s.r.l. 2022/04/28
-- Gestione calcolo batch disposizione e lavorazioni per Travi
-- 2021/01/07 Per nuova interfaccia Egt.
-- 2021/01/15 CREATE_BAR ora FLAG = 6 (prima 5).
@@ -8,6 +8,8 @@
-- 2021/06/16 Se disponibile si aggiunge la versione dell'eseguibile alle info del programma CN.
-- 2021/08/04 Direzione vista simulazione da BD.SIMUL_VIEW_DIR se esiste.
-- 2022/01/07 Per CUTID/TASKID senza ToProcess si verificano anche eventuali Duplo.
-- 2022/02/09 Aggiornato come Wall per gestione errori e verifica attrezzaggio utensili.
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
-- Intestazioni
require( 'EgtBase')
@@ -110,8 +112,7 @@ local function ResetMachGroup( vBeam)
end
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
-- Se necessario, impostazione della macchina corrente
local sMachine = BEAM.MACHINE
@@ -193,7 +194,7 @@ if bToProcess then
return
end
-- Faccio copia del file originale
EgtCopyFile( BEAM.FILE, sDir..sTitle..'.ori'..sExt)
EgtCopyFile( BEAM.FILE, sOriFile)
-- Aggiorno eventuali dati ausiliari
--UpdateAuxData( sBtmFile)
@@ -286,11 +287,10 @@ if bToProcess then
table.insert( vBeam, { Id = nPartId, PosX = dPosX, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
end
if #vBeam == 0 then
--BEAM.ERR = 14
--BEAM.MSG = 'Error : no beams in the project'
--WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
--return
EgtOutLog( 'Travi non trovate', 1)
BEAM.ERR = 14
BEAM.MSG = 'Error : no beams in the project'
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
return
else
local sOut = ''
for i = 1, #vBeam do
@@ -423,14 +423,15 @@ if bToProcess then
-- box del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
-- creo o pulisco gruppo geometrie aggiuntive
-- se nel grezzo c'è un pezzo
if nPartId then
-- creo o pulisco gruppo geometrie aggiuntive
BL.CreateOrEmptyAddGroup( nPartId)
-- aggiungo faccia per taglio iniziale al pezzo
BL.AddPartStartFace( nPartId, b3Solid)
-- aggiungo faccia per taglio finale al pezzo
BL.AddPartEndFace( nPartId, b3Solid)
end
-- aggiungo faccia per taglio iniziale al pezzo
BL.AddPartStartFace( nPartId, b3Solid)
-- aggiungo faccia per taglio finale al pezzo
BL.AddPartEndFace( nPartId, b3Solid)
-- passo al successivo grezzo
nRawId = EgtGetNextRawPart( nRawId)
end
@@ -455,13 +456,16 @@ if bToProcess then
-- Abilito Vmill
EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1')
-- Aggiorno Setup utensili
EgtImportSetup()
-- Lavoro le features
local bPfOk, Stats = BE.ProcessFeatures()
local sOutput = ''
for i = 1, #Stats do
local sMsg = Stats[i].Msg
sMsg = string.gsub( sMsg, '\n', ' ', 10)
sMsg = string.gsub( sMsg, '\r', ' ', 10)
sMsg = string.gsub( sMsg or '', '\n', ' ', 10)
sMsg = string.gsub( sMsg or '', '\r', ' ', 10)
if Stats[i].Err == 0 then
BEAM.ERR = 0
BEAM.MSG = '---'
@@ -519,33 +523,33 @@ else
-- Carico il progetto già fatto
EgtOpenFile( sNgeFile)
-- Dichiaro nessun errore
local nPartId = EgtGetFirstPart()
while nPartId do
local vDup = EgtDuploList( nPartId)
if not vDup or #vDup == 0 then
vDup = { nPartId}
end
for i = 1, #vDup do
local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i')
if nCutId then
local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( vDup[i], 'Processings') or GDB_ID.NULL)
while nProcId do
local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC')
local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i')
if bIsFea and nTaskId then
BEAM.ERR = 0
BEAM.MSG = '---'
BEAM.ROT = 0
BEAM.CUTID = nCutId
BEAM.TASKID = nTaskId
WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
end
nProcId = EgtGetNext( nProcId)
end
end
end
nPartId = EgtGetNextPart( nPartId)
end
--local nPartId = EgtGetFirstPart()
--while nPartId do
-- local vDup = EgtDuploList( nPartId)
-- if not vDup or #vDup == 0 then
-- vDup = { nPartId}
-- end
-- for i = 1, #vDup do
-- local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i')
-- if nCutId then
-- local nProcId = EgtGetFirstInGroup( EgtGetFirstNameInGroup( vDup[i], 'Processings') or GDB_ID.NULL)
-- while nProcId do
-- local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC')
-- local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i')
-- if bIsFea and nTaskId then
-- BEAM.ERR = 0
-- BEAM.MSG = '---'
-- BEAM.ROT = 0
-- BEAM.CUTID = nCutId
-- BEAM.TASKID = nTaskId
-- WriteErrToLogFile( BEAM.ERR, BEAM.MSG, BEAM.ROT, BEAM.CUTID, BEAM.TASKID)
-- end
-- nProcId = EgtGetNext( nProcId)
-- end
-- end
-- end
-- nPartId = EgtGetNextPart( nPartId)
--end
-- Aggiorno eventuali dati ausiliari
--UpdateAuxData( sBtmFile)
-- Passo in modalità lavora
@@ -565,6 +569,20 @@ end
-- *** Eseguo simulazione con verifica collisione in cieco ***
if ( BEAM.FLAG == 0 and ( bToProcess or bToRecalc)) or BEAM.FLAG == 3 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Simulating with collision check >>>')
-- verifico setup
local bSetUpOk, SetUpErrors = EgtVerifyCurrSetup()
if not bSetUpOk then
local sToolsList = ""
for ToolIndex = 1, #SetUpErrors do
sToolsList = sToolsList .. SetUpErrors[ToolIndex]
if ToolIndex ~= #SetUpErrors then
sToolsList = sToolsList .. ", "
end
end
WriteErrToLogFile( 19, 'Error in setup: tool/s ' .. sToolsList .. ' not found', 0, 0, 0)
return
end
-- lancio simulazione
local bSimOk, nErr, sErr = EgtSimulate()
if not bSimOk then
if nErr == MCH_SHE.INIT then
@@ -603,10 +621,11 @@ end
-- *** Genero programma CN *** ( se richiesto)
if BEAM.FLAG == 0 or BEAM.FLAG == 4 then
EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5 - '
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
if EgtGetExeVersion then
sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - '
sInfo = sInfo .. ' ver.' .. EgtGetExeVersion()
end
sInfo = sInfo .. ' - '
if not EgtGenerate( '', sInfo .. sNgeFile) then
BEAM.ERR = 20
local _, sName, _ = EgtSplitPath( BEAM.FILE)
@@ -631,7 +650,7 @@ local Ttot = EgtGetInfo( EgtGetCurrMachGroup(), 'Ttot', 'd')
local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1)
EgtOutLog( sTime)
-- Imposto la vista ISO 3d, se richiesto
-- Se modifica o simula, imposto la vista ISO 3d opportuna
if BEAM.FLAG == 1 or BEAM.FLAG == 2 then
local vView = { SCE_VD.ISO_NW, SCE_VD.ISO_SW, SCE_VD.ISO_NE, SCE_VD.ISO_SE}
local nV = min( max( BD.SIMUL_VIEW_DIR or 2, 1), 4)
+103
View File
@@ -0,0 +1,103 @@
REM Compilazione degli script Beam Egaltech 2022.05.09
REM Per togliere info di debug aggiungere flag -s prima del nome del file di input
REM Compilazione 32 bit
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
\EgtProg\Dll32\luac53 -o 32\BatchProcess.lua BatchProcess.lua
\EgtProg\Dll32\luac53 -o 32\BatchProcessNew.lua BatchProcessNew.lua
\EgtProg\Dll32\luac53 -o 32\GetBeamData.lua GetBeamData.lua
\EgtProg\Dll32\luac53 -o 32\NestProcess.lua NestProcess.lua
\EgtProg\Dll32\luac53 -o 32\Process.lua Process.lua
\EgtProg\Dll32\luac53 -o 32\Rotate.lua Rotate.lua
\EgtProg\Dll32\luac53 -o 32\Swap.lua Swap.lua
REM Compilazione 64 bit
\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessCut.lua LuaLibs\ProcessCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDecor.lua LuaLibs\ProcessDecor.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDoubleCut.lua LuaLibs\ProcessDoubleCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDovetail.lua LuaLibs\ProcessDovetail.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDrill.lua LuaLibs\ProcessDrill.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtMortise.lua LuaLibs\ProcessDtMortise.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessDtTenon.lua LuaLibs\ProcessDtTenon.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFreeContour.lua LuaLibs\ProcessFreeContour.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessFrenchRidgeLap.lua LuaLibs\ProcessFrenchRidgeLap.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessHeadCut.lua LuaLibs\ProcessHeadCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJoint.lua LuaLibs\ProcessLapJoint.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLapJointNew.lua LuaLibs\ProcessLapJointNew.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongCut.lua LuaLibs\ProcessLongCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessLongDoubleCut.lua LuaLibs\ProcessLongDoubleCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMark.lua LuaLibs\ProcessMark.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessMortise.lua LuaLibs\ProcessMortise.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfCamb.lua LuaLibs\ProcessProfCamb.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConcave.lua LuaLibs\ProcessProfConcave.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfConvex.lua LuaLibs\ProcessProfConvex.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfFront.lua LuaLibs\ProcessProfFront.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessProfHead.lua LuaLibs\ProcessProfHead.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRidgeLap.lua LuaLibs\ProcessRidgeLap.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessRoundArch.lua LuaLibs\ProcessRoundArch.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSawCut.lua LuaLibs\ProcessSawCut.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessScarfJoint.lua LuaLibs\ProcessScarfJoint.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSimpleScarf.lua LuaLibs\ProcessSimpleScarf.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessSplit.lua LuaLibs\ProcessSplit.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJoint.lua LuaLibs\ProcessStepJoint.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessStepJointNotch.lua LuaLibs\ProcessStepJointNotch.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
\EgtProg\Dll64\luac53 -o 64\BatchProcess.lua BatchProcess.lua
\EgtProg\Dll64\luac53 -o 64\BatchProcessNew.lua BatchProcessNew.lua
\EgtProg\Dll64\luac53 -o 64\GetBeamData.lua GetBeamData.lua
\EgtProg\Dll64\luac53 -o 64\NestProcess.lua NestProcess.lua
\EgtProg\Dll64\luac53 -o 64\Process.lua Process.lua
\EgtProg\Dll64\luac53 -o 64\Rotate.lua Rotate.lua
\EgtProg\Dll64\luac53 -o 64\Swap.lua Swap.lua
+44
View File
@@ -0,0 +1,44 @@
-- GetWallData.lua by Egaltech s.r.l. 2022/06/28
-- Recupero dati da file WallData.lua di macchina
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Per test
--GWD = {}
--GWD.MACHINE = 'Essetre-90480019_MW'
local sLog = 'GetBeamData : ' .. GWD.MACHINE
EgtOutLog( sLog)
-- Imposto direttorio libreria specializzata per Travi
EgtAddToPackagePath( GWD.BASEDIR .. '\\LuaLibs\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
local sMachDir = EgtGetCurrMachineDir()
if not EgtExistsFile( sMachDir .. '\\Beam\\BeamData.lua') then
GWD.ERR = 12
GWD.MSG = 'Error not configured for beam machine : ' .. GWD.MACHINE
WriteErrToLogFile( GWD.ERR, GWD.MSG)
PostErrView( GWD.ERR, GWD.MSG)
return
end
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua')
-- Carico i dati globali
_G.package.loaded.BeamData = nil
local BD = require( 'BeamData')
-- Assegno valori di interesse
GWD.SIMUL_VIEW_DIR = BD.SIMUL_VIEW_DIR
GWD.OVM_MID = BD.OVM_MID
-- Tutto ok
GWD.ERR = 0
EgtOutLog( ' +++ GetWallData completed')
+448 -188
View File
@@ -1,4 +1,4 @@
-- BeamExec.lua by Egaltech s.r.l. 2021/12/20
-- BeamExec.lua by Egaltech s.r.l. 2022/06/25
-- Libreria esecuzione lavorazioni per Travi
-- 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.
@@ -25,6 +25,13 @@
-- 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/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.
-- Tabella per definizione modulo
local BeamExec = {}
@@ -121,11 +128,272 @@ EgtOutLog( ' BeamExec started', 1)
EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC)
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 ***
-------------------------------------------------------------------------------------------------------------
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
BeamExec.CalcMinUnloadableRaw( dRawW, dRawH)
@@ -156,7 +424,13 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
local Len = dRawL
local nPrevRaw, dPrevDelta
local DeltaS = dOvmHead
local DeltaSMin = 0
local DeltaE = BD.OVM_MID
-- controllo sezione larga e alta per considerare taglio con sega
local bBigSectionCut = false
if BD.MAX_DIM_HTCUT and BD.CUT_EXTRA_MIN and ( dRawW > 2 * BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( dRawH > 2 * BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) then
bBigSectionCut = true
end
for i = 1, #vBeam do
-- assegno identificativo pezzo
local Pz = vBeam[i].Id
@@ -164,6 +438,37 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT)
local b3Solid = vBeam[i].Box
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)
-- se sezione compatibile e lunghezza disponibile sufficiente
local PartLen = b3Solid:getDimX()
@@ -174,8 +479,8 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
( abs( PartHeight - dRawW) < 10 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 10 * GEO.EPS_SMALL)) and
NextLen + DeltaE >= 0 then
-- eventuale sovramateriale di testa
if vBeam[i].PosX then
DeltaS = max( vBeam[i].PosX - ( dRawL - Len), 0)
if i > 1 and vBeam[i].PosX then
DeltaS = max( vBeam[i].PosX - ( dRawL - Len), DeltaSMin)
end
-- dimensioni del grezzo
local CrawLen = min( PartLen + DeltaS + DeltaE, Len)
@@ -201,6 +506,9 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
EgtSetInfo( nPrevRaw, 'BDST', DeltaS + dPrevDelta)
end
end
if DeltaE > 0.09 then
EgtSetInfo( nRaw, 'TOVM', DeltaE)
end
-- aggiungo faccia per taglio finale al pezzo
BL.AddPartEndFace( Pz, b3Solid)
-- inserisco il pezzo nel grezzo
@@ -221,6 +529,9 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
-- aggiorno grezzo precedente
nPrevRaw = nRaw
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
-- se rimasto troppo poco grezzo, esco
--if Len < BD.MinRaw then break end
@@ -275,71 +586,6 @@ local function Verify90DegRotation( nRawId)
( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL)
end
-------------------------------------------------------------------------------------------------------------
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)
-- 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
-------------------------------------------------------------------------------------------------------------
local function PrintFeatures( vProc, b3Raw)
EgtOutLog( ' RawBox=' .. tostring( b3Raw))
@@ -347,7 +593,8 @@ local function PrintFeatures( vProc, b3Raw)
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',
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))
-- info speciali per Block Haus Half Lap
if Proc.Prc == 37 then
@@ -358,93 +605,6 @@ local function PrintFeatures( vProc, b3Raw)
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)
@@ -511,6 +671,14 @@ local function OrderFeatures( vProc, b3Raw)
if B2.Tail and ( Split.Identify( B1) or not B1.Tail) then
return true
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
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
@@ -523,9 +691,13 @@ local function OrderFeatures( vProc, b3Raw)
end
-- 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
-- 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
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
return B2.Tail or B1.Box:getMin():getX() + 20 > B2.Box:getCenter():getX()
end
@@ -609,10 +781,13 @@ local function OrderFeatures( vProc, b3Raw)
end
for i = 1, #vProc do
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
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
if j > i + 1 then
local ProcK = vProc[i+1]
@@ -646,10 +821,12 @@ local function OrderFeatures( vProc, b3Raw)
local dMarkRange = 300
for i = 1, #vProc do
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
local ProcJ = vProc[j]
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
abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dMarkRange then
if j > i + 1 then
@@ -664,10 +841,13 @@ local function OrderFeatures( vProc, b3Raw)
local dBHHLRange = 100
for i = 1, #vProc do
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
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 ProcJ.vtN:getY() < -0.5 then
table.insert( vProc, i, table.remove( vProc, j))
@@ -705,12 +885,18 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
local bSplitRot = false
local nHeading
local nSplitting
local vMachineBeforeIntersectingDrillingsId = {}
for i = 1, #vProc do
local Proc = vProc[i]
local bOk = true
local bDown = false
local bSide = false
local bDownSideOnHeadOk = false
if Proc.MachineBeforeIntersectingDrillings then
table.Insert ( vMachineBeforeIntersectingDrillingsId, Proc.Id)
end
-- se senza geometria (già disabilitato
if Proc.Flg == 0 then
bOk = false
@@ -872,10 +1058,10 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
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 sErr = ''
local bNewPhase = false
local nNewPhase = -1
EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1)
-- se intestatura ( 1-340-X )
if Hcut.Identify( Proc) then
@@ -884,13 +1070,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se separazione ( 2-350-X )
elseif Split.Identify( Proc) then
-- esecuzione separazione o eliminazione grezzo residuo
bOk, sErr = Split.Make( Proc, nPhase, nRawId, nPartId)
-- richiedo il passaggio alla seconda fase di lavorazione di questa trave
bNewPhase = true
bOk, sErr, nNewPhase = Split.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
-- se taglio ( 1/2-010-X)
elseif Cut.Identify( Proc) then
-- 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)
elseif DoubleCut.Identify( Proc) then
-- esecuzione doppio taglio
@@ -911,7 +1095,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se taglio con lama ( 0/3/4-013-X)
elseif SawCut.Identify( Proc) then
-- 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)
elseif RidgeLap.Identify( Proc) then
-- esecuzione mezzo-legno di testa
@@ -933,11 +1117,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se giunzione francese ( 1/2-035-X)
elseif FrenchRidgeLap.Identify( Proc) then
-- 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)
elseif BlockHausFront.Identify( Proc) then
-- 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)
elseif Tenon.Identify( Proc) then
-- esecuzione tenone
@@ -965,11 +1149,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se giunto Gerber ( 1/2-071-X)
elseif ScarfJoint.Identify( Proc) then
-- 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)
elseif Scarf.Identify( Proc) then
-- 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)
elseif StepJoint.Identify( Proc) then
-- esecuzione giunto a gradino
@@ -1004,10 +1188,10 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
bOk, sErr = ProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se incastro tirolo ( 1/2/3/4-136-X)
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)
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)
elseif FreeContour.Identify( Proc) then
-- esecuzione contorno
@@ -1022,7 +1206,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
EgtOutLog( sErr)
bOk = false
end
return bOk, sErr, bNewPhase
return bOk, sErr, nNewPhase
end
-------------------------------------------------------------------------------------------------------------
@@ -1129,8 +1313,68 @@ local function MoveDrillsOnTenon( vProc)
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()
if BD.IMPROVE_HEAD_TAIL_DRILLINGS == nil then
BD.IMPROVE_HEAD_TAIL_DRILLINGS = true
end
-- verifica se possibile rotazione di 90 gradi
BD.ROT90 = BD.ROT90 and Verify90DegRotation( EgtGetFirstRawPart())
-- ciclo sui pezzi
@@ -1156,8 +1400,13 @@ function BeamExec.ProcessFeatures()
-- ingombro del grezzo e sovramateriale di testa
local b3Raw = EgtGetRawPartBBox( nRawId)
local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', 'd') or 0
local dCurrOvmT = EgtGetInfo( nRawId, 'TOVM', 'd') or 0
-- 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
OrderFeatures( vProc, b3Raw)
-- le classifico
@@ -1176,8 +1425,11 @@ function BeamExec.ProcessFeatures()
SetCutsOnFrontMortises( vProc)
-- eventuale spostamento fori sui tenoni
MoveDrillsOnTenon( vProc)
-- identifico la condizione di lavorazione, in base a bSomeDown e bSomeSide
local sDownOrSideOrStd = 'STD'
-- 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
local nRId = nRawId
while nRId do
@@ -1190,7 +1442,7 @@ function BeamExec.ProcessFeatures()
-- creo la lavorazione
local Proc = vProc[i]
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
nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1199,8 +1451,10 @@ function BeamExec.ProcessFeatures()
else
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
end
-- se era taglio di separazione, aggiungo nuova fase
if bNewPhase then
-- se è taglio di separazione, verifico se ha già aggiunto una nuova fase oppure se è da creare
if nNewPhase > 0 then
nPhase = nNewPhase
elseif nNewPhase == 0 then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
EgtRotateRawPart( nRawId, X_AX(), 180)
-- se grezzo successivo senza pezzi e finale, va tolto
@@ -1237,7 +1491,8 @@ function BeamExec.ProcessFeatures()
EgtSetInfo( nDispId, 'ORD', nOrd)
end
-- 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
local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ()
local vtMove = Vector3d( 0, dDeltaYZ / 2, dDeltaYZ / 2)
@@ -1257,7 +1512,7 @@ function BeamExec.ProcessFeatures()
-- creo la lavorazione
local Proc = vProc[i]
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
nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1268,7 +1523,9 @@ function BeamExec.ProcessFeatures()
end
if bOk then nSideMchOk = nSideMchOk + 1 end
-- 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)
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
@@ -1307,12 +1564,13 @@ function BeamExec.ProcessFeatures()
EgtSetInfo( nDispId, 'TYPE', EgtIf( not bSplitRot, 'MID', 'END2'))
EgtSetInfo( nDispId, 'ORD', nOrd)
end
sDownOrSideOrStd = 'STD'
-- inserisco le lavorazioni non ribaltate della trave
for i = 1, #vProc do
-- creo la lavorazione
local Proc = vProc[i]
if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD) then
local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw)
if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD or BD.TURN) then
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
if not bOk then
nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -1322,7 +1580,9 @@ function BeamExec.ProcessFeatures()
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
end
-- 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)
-- se grezzo successivo senza pezzi e finale, va tolto
local nNextRawId = EgtGetNextRawPart( nRawId)
+119 -33
View File
@@ -1,4 +1,4 @@
-- BeamLib.lua by Egaltech s.r.l. 2022/01/11
-- BeamLib.lua by Egaltech s.r.l. 2022/07/12
-- Libreria globale per Travi
-- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto.
-- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm.
@@ -9,6 +9,11 @@
-- 2021/07/15 Aggiunta GetFaceElevationFromPointDir.
-- 2021/09/12 Aggiustamenti in GetNearestParalOpposite e GetNearestOrthoOpposite.
-- 2022/01/11 In GetNearest*Opposite ridotto vantaggio XY rispetto a Z da 1 -> 0.9 a 1 -> 0.99.
-- 2022/04/05 Modifiche a GetNzLimDownUp per FAST.
-- 2022/05/03 Ulteriore limitazione a GetNzLimDownUp per FAST.
-- 2022/05/18 Correzioni e migliorie a PutStartNearestToEdge.
-- 2022/06/25 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs prima in ProcessLapJpoint.
-- 2022/07/12 A GetFaceHvRefDim aggiunta possibilità di confronto e limitazione dimensioni con grezzo/pezzo (conta solo la sezione).
-- Tabella per definizione modulo
local BeamLib = {}
@@ -186,40 +191,42 @@ function BeamLib.PutStartOnLonger( nCrvId)
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, bDown)
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, bDown)
-- verifico che la curva sia chiusa
if not EgtCurveIsClosed( nCrvId) then return false end
-- recupero il versore normale al piano di lavoro o estrusione
local vtN = EgtCurveExtrusion( nCrvId, GDB_ID.ROOT)
-- coefficienti per riportare la distanza nel piano di lavoro
local dCoeffX = 1 / ( sqrt( 1 - vtN:getX() * vtN:getX()))
local dCoeffY = 1 / ( sqrt( 1 - vtN:getY() * vtN:getY()))
local dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ()))
local dCoeffY = 0
if abs( vtN:getY()) < 0.999 then dCoeffY= 1 / ( sqrt( 1 - vtN:getY() * vtN:getY())) end
local dCoeffZ = 0
if abs( vtN:getZ()) < 0.999 then dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ())) end
-- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa)
local dUopt = 0
local dDopt = GEO.INFINITO
local dZopt = GEO.INFINITO
local dUi, dUf = EgtCurveDomain( nCrvId)
for dU = dUi, dUf, 0.5 do
local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT)
if ptP then
local vtDp = EgtUV( nCrvId, dU, -1, GDB_ID.ROOT)
local vtDs = EgtUV( nCrvId, dU, 1, GDB_ID.ROOT)
local bTg = ( vtDp and vtDs and vtDp * vtDs > 0.96)
if ptP and bTg then
local vtMin = ptP - b3Raw:getMin()
local vtMax = ptP - b3Raw:getMax()
local dD = abs( vtMin:getX()) * dCoeffX
dD = min( abs( vtMax:getX()) * dCoeffX, dD)
dD = min( abs( vtMin:getY()) * dCoeffY, dD)
local dD = abs( vtMin:getY()) * dCoeffY
dD = min( abs( vtMax:getY()) * dCoeffY, dD)
if bDown then
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
else
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
end
if dD < dDopt + GEO.EPS_SMALL then
dDopt = dD
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
local dZ = abs( EgtIf( bDown, vtMin:getZ(), vtMax:getZ())) * dCoeffZ
if dD < dMaxDist and dZ < dZopt + GEO.EPS_SMALL then
dUopt = dU
dDopt = dD
dZopt = dZ
end
end
end
if abs( dUopt - dUi) > GEO.EPS_ZERO then
if abs( dUopt - dUi) > GEO.EPS_ZERO and abs( dUopt - dUf) > GEO.EPS_ZERO then
EgtChangeClosedCurveStart( nCrvId, dUopt)
end
return true
@@ -264,8 +271,8 @@ function BeamLib.GetNearestParalOpposite( vtRef, vtNorm)
vtMyRef:normalize()
end
-- se prevalente una componente orizzontale (con piccolissimo vantaggio)
if abs( vtMyRef:getX()) > 0.99 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.99 * abs( vtMyRef:getZ()) then
if abs( vtMyRef:getX()) > abs( vtMyRef:getY()) - GEO.EPS_SMALL then
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then
if vtMyRef:getX() > -GEO.EPS_SMALL then
return MCH_MILL_FU.PARAL_LEFT
else
@@ -298,9 +305,9 @@ function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm)
vtMyRef:normalize()
end
-- se prevalente una componente orizzontale (con piccolissimo vantaggio)
if abs( vtMyRef:getX()) > 0.99 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.99 * abs( vtMyRef:getZ()) then
-- se prevale la componente destra/sinistra (con piccolo vantaggio)
if abs( vtMyRef:getX()) > 0.9 * abs( vtMyRef:getY()) then
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then
-- se prevale la componente destra/sinistra
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then
if vtMyRef:getX() > -GEO.EPS_SMALL then
return MCH_MILL_FU.ORTHO_LEFT
else
@@ -403,7 +410,7 @@ function BeamLib.GetBoxFaceNorm( b3Box, ptP, vtV)
local dNzDotV = vtNz * vtV
if dNxDotV > dNyDotV and dNxDotV > dNzDotV then
return vtNx
elseif dNyDotV > dNzDotV and dNyDotV > dNxDotV then
elseif dNyDotV > dNzDotV then
return vtNy
else
return vtNz
@@ -644,7 +651,7 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
end
---------------------------------------------------------------------
function BeamLib.GetFaceHvRefDim( nSurfId, nFacet)
function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw)
-- recupero centro e normale della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
if not ptC or not vtN then return end
@@ -655,8 +662,21 @@ function BeamLib.GetFaceHvRefDim( nSurfId, nFacet)
end
-- determino l'ingombro in questo riferimento
local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV)
local dDimH = b3HV:getDimX()
local dDimV = b3HV:getDimY()
-- se definito grezzo (o solido), applico eventuali limiti
if b3Raw then
local dCoeffY = abs( frHV:getVersX():getY())
if dCoeffY > GEO.EPS_SMALL then
dDimH = min( dDimH, b3Raw:getDimY() / dCoeffY)
end
local dCoeffZ = abs( frHV:getVersY():getZ())
if dCoeffZ > GEO.EPS_SMALL then
dDimV = min( dDimV, b3Raw:getDimZ() / dCoeffZ)
end
end
-- restituisco i valori calcolati
return frHV, b3HV:getDimX(), b3HV:getDimY()
return frHV, dDimH, dDimV
end
-------------------------------------------------------------------------------------------------------------
@@ -679,15 +699,51 @@ function BeamLib.UpdateTCING( nRawId, dTCI)
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetNzLimDownUp( b3Raw, bFromTop)
if not BD.C_SIMM then
if bFromTop then
return EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM, -0.609, -0.383)
else
return EgtIf( b3Raw:getDimZ() < 200, -0.5, -0.258)
end
else
function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
if BD.C_SIMM or BD.TURN then
return -0.484
else
if vtOrtho and vtOrtho:getZ() > 0.5 then
-- N_HorAng < 15° or N_HorAng > 55°
if vtN and ( abs( vtN:getY()) < 0.259 or abs( vtN:getY()) > 0.819) then
return -0.708
-- N_HorAng > 50°
elseif vtN and abs( vtN:getY()) > 0.766 then
return -0.383
else
return EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM, -0.609, -0.383)
end
else
-- N_HorAng > 60°
if vtN and ( abs( vtN:getY()) > 0.866) then
return -0.708
else
if b3Raw:getDimZ() < 120 then
return -0.708
elseif b3Raw:getDimZ() < 200 then
-- N_HorAng < 15° or N_HorAng > 55°
if vtN and ( abs( vtN:getY()) < 0.259 or abs( vtN:getY()) > 0.819) then
return -0.5
else
return -0.383
end
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM then
-- N_HorAng < 10°
if vtN and ( abs( vtN:getY()) < 0.174) then
return -0.5
else
return -0.24
end
else
-- N_HorAng < 10°
if vtN and ( abs( vtN:getY()) < 0.174) then
return -0.383
else
return -0.174
end
end
end
end
end
end
@@ -708,5 +764,35 @@ function BeamLib.GetPhaseType( nPhase)
return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'TYPE') or '')
end
---------------------------------------------------------------------
function BeamLib.GetChainSawBlockedAxis( nInd)
if BD.GetChainSawBlockedAxis then
return BD.GetChainSawBlockedAxis( nInd)
else
if nInd == 1 then
return EgtIf( BD.C_SIMM, 'A=90', 'A=90')
else
return EgtIf( BD.C_SIMM, 'A=0', 'A=0')
end
end
end
---------------------------------------------------------------------
function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd)
if BD.GetChainSawInitAngs then
return BD.GetChainSawInitAngs( vtN, vtO, nInd)
else
if BD.C_SIMM then
return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180')
else
if nInd == 1 then
return ''
else
return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180')
end
end
end
end
-------------------------------------------------------------------------------------------------------------
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
-- 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
vtO:rotate( vtNInner, 90)
-- se diretto troppo ortogonalmente all'asse trave e taglio non da sotto, lo ruoto ulteriormente
if abs( vtO:getY()) > 3 * abs( vtO:getX()) and vtNInner:getZ() > dNzLimDwnUp then
if ( abs( vtO:getY()) > 3 * abs( vtO:getX()) or BBoxRawPart:getDimZ() > 620) and vtNInner:getZ() > dNzLimDwnUp then
vtO:rotate( vtNInner, 90)
-- se faccia principale verso il basso (almeno -3deg), lo inverto per iniziare da sopra
if vtNInner:getZ() < -0.05 then
@@ -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
if not bGetOrtoPlanes then
VerifyFirstOrthoCut( UltimateTable, originalOffsetP, BBoxRawPart, dNzLimDwnUp)
-- se rimangono due sole facce, devono coincidere con le originali e quindi sono superflue
if #UltimateTable == 2 and #UltimateTable[1] == 1 and #UltimateTable[2] == 1 then
EgtErase( UltimateTable[1][1])
EgtErase( UltimateTable[2][1])
UltimateTable = {}
end
end
return UltimateTable
+101
View File
@@ -0,0 +1,101 @@
-- FaceByPocket.lua by Egaltech s.r.l. 2022/05/82
-- Gestione svuotatura di feature con una faccia
-- Tabella per definizione modulo
local FaceByPocket = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
EgtOutLog( ' FaceByPocket started', 1)
-- Dati
local BD = require( 'BeamData')
local ML = require( 'MachiningLib')
---------------------------------------------------------------------
local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, vtN)
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nInd
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
-- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
if dMaxElev > 0.1 then
-- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dMaxElev, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM and not BD.TURN then
nSCC = EgtIf( vtN:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid)
local bOk = true
local sErr
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dStep = 30
local dMaxDepth = 100
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
local dElev = BL.GetFaceElevation( nSurfId, nFacet, nPartId)
-- determino numero e valore degli step di lavorazione
local nSurfStep = ceil( dElev / dMaxDepth)
local dSurfStep = dElev / nSurfStep
-- copio superfice al passo superfice e vi applico la lavorazione
for i = nSurfStep, 2, -1 do
local ptOn = ptC + ( dSurfStep * ( i - 1)) * vtN
local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptOn, vtN, b3Solid, GDB_RT.GLOB)
if nAddIdTmp then
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
-- aggiungo lavorazione
bOk, sErr = ApplyPocket( Proc, nAddIdTmp, 0, sPocketing, i, dSurfStep, vtN)
if not bOk then
return false, sErr
end
end
end
-- faccio ultima superfice
bOk, sErr = ApplyPocket( Proc, nSurfId, nFacet, sPocketing, 1, EgtIf( nSurfStep > 1, dSurfStep, 0), vtN)
if not bOk then
return false, sErr
end
return true
end
return FaceByPocket
+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
-- 2021/01/06 Cambiato limite per attacco Tg con lama e CalcLeadInOutGeom rinominata in CalcLeadInOutPerpGeom.
-- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg.
@@ -10,6 +10,8 @@
-- 2021/08/03 In MakeOneFaceBySaw mgliorata gestione tagli con normale verso il basso e da sopra.
-- 2021/08/31 DS Aggiunta gestione nessun limite direzione da sotto per testa da sotto.
-- 2021/11/26 DS Spostate qui MakeOneFaceBySaw (ora MakeOne), CalcLeadInOutPerpGeom e CalcLeadInOutTangGeom.
-- 2022/04/12 DS Aggiunta gestione speciale cubetti con fresa da sotto.
-- 2022/06/29 DS In MakeTwo modificato controllo facce dirette verso il basso.
-- Tabella per definizione modulo
local FacesBySaw = {}
@@ -39,6 +41,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
nOrthoOpposite = Par5
vtOrthO = BL.GetVersRef( Par5)
end
-- verifico se testa da sotto
local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5)
-- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach)
local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth = EgtSurfTmFacetOppositeSide( nSurfId, nFacet, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT)
if not dLen or dLen < 1.1 or not dWidth or dWidth < 1.1 then
@@ -83,8 +87,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
end
end
-- verifico se lavorazione con lama sotto e testa sopra
local bFromTop = ( nOrthoOpposite == MCH_MILL_FU.ORTHO_DOWN)
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, bFromTop) end
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end
local bDownUp = ( vtN:getZ() < dVzLimDwnUp)
local nFaceUse = nOrthoOpposite
if bDownUp then nFaceUse = BL.GetOrtupOpposite( nOrthoOpposite) end
@@ -127,30 +130,39 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
local dLenLi2 = abs( dLi2Tang)
local dLenLo2 = abs( dLo2Tang)
-- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale)
local bTurnTang
local Ktp = 1.1
if BD.KIOTP then Ktp = BD.KIOTP end
if ( not bDownUp or abs( vtTg:getY()) > 0.5) and abs( vtTg:getX()) < 0.9848 and
( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5)) or
if ( not bDownUp or abs( vtTg:getY()) > 0.5) and
( not bDownHead or abs( vtTg:getZ()) < 0.51) and
abs( vtTg:getX()) < 0.9848 and
( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or
( abs( vtTg:getZ()) < 0.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450) or
( Ktp * dLenLi2 < dLenLi and Ktp * dLenLo2 < dLenLo) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) then
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
if BD.TURN then
bTurnTang = true
dLoTang = -( dLiTang + dAllStart - dAccStart + dAllEnd - dAccEnd + dLen)
dLoPerp = BD.COLL_SIC
end
end
-- posizione braccio
EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3)
local nSCC = MCH_SCC.NONE
--if not BD.C_SIMM or vtRef:getZ() < 0.866 or abs( vtTg:getZ()) > 0.02 then
if not BD.TURN then
if abs( vtAux:getX()) > abs( vtAux:getY()) - GEO.EPS_SMALL then
nSCC = EgtIf( ( vtAux:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
else
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end
--end
-- per macchine PF se possibile preferisco tenere la testa più davanti
--if BD.C_SIMM and abs( vtTg:getZ()) < 0.01 and abs( vtTg:getX()) < 0.5 then
-- if nSCC == MCH_SCC.ADIR_YP then
-- nSCC = MCH_SCC.ADIR_YM
-- end
--end
else
local vtTest = EgtIf( bTurnTang, EgtIf( bInvert, vtTg, -vtTg), vtOut)
if abs( vtTest:getY()) > abs( vtTest:getZ()) then
nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( vtTest:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
end
-- inserisco la lavorazione di taglio
local sName = 'Cut_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_' .. tostring( nFacet + 1)
local nMchFId = EgtAddMachining( sName, sCutting)
@@ -176,6 +188,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
-- imposto attacco/uscita
EgtSetMachiningParam( MCH_MP.LITANG, dLiTang)
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
if bTurnTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end
EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang)
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
-- imposto allungamenti iniziale e finale
@@ -184,7 +197,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
-- eventuali note
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -217,15 +230,6 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
local vtN = {}
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
-- verifico non siano orientate verso il basso
local bFaceOk = {}
bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB)
bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB)
if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then
local sErr = 'Error : TwoFacesBySaw from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- recupero dati su giunzione tra facce
local bTouch, ptT1, ptT2, dAngT = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
if not bTouch then
@@ -233,44 +237,64 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
EgtOutLog( sErr)
return false, sErr
end
local ptM = ( ptT1 + ptT2) / 2
local vtTg = ptT2 - ptT1 ;
local bConvex = ( dAngT > 0)
-- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg)
local bFaceOk = {}
bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB or abs( vtN[1]:getY()) < 0.174)
bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB or abs( vtN[2]:getY()) < 0.174)
if not bDownHead and not bFaceOk[1] and not bFaceOk[2] then
local sErr = 'Error : TwoFacesBySaw from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- calcolo direzione di lavoro
local vtRef = {}
local vtTg = ptT2 - ptT1 ;
vtRef[1] = vtN[1] ^ vtTg
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
vtRef[1]:normalize()
if abs( vtRef[1]:getZ()) < 0.577 and abs( abs( vtRef[1]:getX()) - abs( vtRef[1]:getY())) < 0.1 then
vtRef[1] = ptC[1] - ptM
vtRef[1]:normalize()
end
vtRef[2] = vtN[2] ^ vtTg
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end
vtRef[2]:normalize()
if abs( vtRef[2]:getZ()) < 0.577 and abs( abs( vtRef[2]:getX()) - abs( vtRef[2]:getY())) < 0.1 then
vtRef[2] = ptC[2] - ptM
vtRef[2]:normalize()
end
-- determino quale faccia è più grande
local ptPs = ( ptT1 + ptT2) / 2
local dSqDim1 = ( ptC[1] - ptPs):sqlen()
local dSqDim2 = ( ptC[2] - ptPs):sqlen()
local dSqDim1 = ( ptC[1] - ptM):sqlen()
local dSqDim2 = ( ptC[2] - ptM):sqlen()
local nBigInd = EgtIf( dSqDim1 > dSqDim2 - 1., 1, 2)
local nSmaInd = 3 - nBigInd
local nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2)
local nOtInd = 3 - nUpInd
-- metto in relazione la scelta facce con il confronto del versore Z con la scelta in base alla grandezza faccia
-- se la faccia più grande è messa secondaria e il suo versore Z non è negativo
if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -5 * GEO.EPS_SMALL and vtN[nSmaInd]:getZ() < 0.866 then
nOtInd = nSmaInd
-- se la faccia più grande è messa secondaria e il suo versore Z non è troppo negativo
if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -0.5 and vtN[nSmaInd]:getZ() < 0.966 then
nUpInd = nBigInd
nOtInd = nSmaInd
end
-- recupero la lavorazione
local sCutting = ML.FindCutting( sCutType)
local sCutting = ML.FindCutting( sCutType, nil, bDownHead)
if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dSawDiam = 400
local dSawThick = 5
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- calcolo extra taglio
@@ -283,45 +307,113 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
if bDownHead then
dNzLimDwnUp = - 2
end
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nUpInd], vtN[nUpInd], false, ptC[nOtInd], vtN[nOtInd])
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nUpInd], vtN[nUpInd], false, ptC[nOtInd], vtN[nOtInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
-- sistemo posizione nel DB, nome e info
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
end
-- eseguo
for i = 1, #vCuts do
-- assegno il modo di tagliare
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nOtInd], vtRef[nUpInd])
-- lavoro la faccia
for j = 1, #vCuts[i] do
-- se FAST, pezzo alto e ultimo taglio verticale -> allungo uscita per consentire eventuale rotazione B sul posto
local dAccEnd = 0
if not BD.C_SIMM and BD.MAX_HEIGHT_ROT_B_ABOVE and b3Raw:getDimZ() > BD.MAX_HEIGHT_ROT_B_ABOVE and vtOrthO:getZ() > 0.866 and j == #vCuts[i] then
dAccEnd = - ( dSawDiam / 2 + BD.CUT_SIC)
-- con testa da sopra
if not bDownHead or BD.TURN then
-- eseguo
for i = 1, #vCuts do
-- assegno il modo di tagliare
local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nOtInd], vtRef[nUpInd])
-- lavoro la faccia
for j = 1, #vCuts[i] do
-- se FAST, pezzo alto e ultimo taglio verticale -> allungo uscita per consentire eventuale rotazione B sul posto
local dAccEnd = 0
if not BD.C_SIMM and BD.MAX_HEIGHT_ROT_B_ABOVE and b3Raw:getDimZ() > BD.MAX_HEIGHT_ROT_B_ABOVE and vtOrthO:getZ() > 0.866 and j == #vCuts[i] then
dAccEnd = - ( dSawDiam / 2 + BD.CUT_SIC)
end
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, dAccEnd, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, dNzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, dAccEnd, nil, b3Raw)
if not bOk then
return bOk, sErr
end
-- altrimenti con testa da sotto
else
-- eseguo (facendo di seguito i due tagli di ogni singolo cubetto)
for i = 1, #vCuts, 2 do
-- determino il modo di tagliare dei perpendicolari
local vtOrthoO_1 = Vector3d( vtN[nUpInd])
-- determino il modo di tagliare dei paralleli
local vtOrthoO_2
local bNoPerpCuts_2 = false
local vtO
if #vCuts[i] > 0 then
vtO = EgtSurfTmFacetNormVersor( vCuts[i][1], 0, GDB_ID.ROOT)
elseif vCuts[i+2] and #vCuts[i+2] > 0 then
-- lunghezza faccia nell'eventuale direzione ortogonale
local asseX = EgtSurfTmFacetNormVersor( vCuts[i+2][1], 0, GDB_ID.ROOT)
local asseY = asseX ^ vtN[nUpInd]
local Frame = Frame3d( ptC, ptC + asseX, ptC + asseY)
local b3Fac = EgtGetBBoxRef( vCuts[i+1][1], GDB_BB.STANDARD, Frame)
-- se lunghezza inferiore al limite, accetto la direzione
if b3Fac:getDimX() < dMaxDepth - BD.CUT_EXTRA then
vtO = asseX
else
bNoPerpCuts_2 = true
end
else
bNoPerpCuts_2 = true
end
if vtO then
vtOrthoO_2 = Vector3d( vtO)
else
if bHorizCut then
vtOrthoO_2 = -Z_AX()
elseif vtN:getY() > -0.02 then
if not Proc.Head then
vtOrthoO_2 = -Y_AX()
else
vtOrthoO_2 = Y_AX()
end
else
vtOrthoO_2 = -Y_AX()
end
end
-- lavoro le coppie di facce del singolo cubetto
for j = 1, max( #vCuts[i], #vCuts[i+1]) do
-- extra taglio per perpendicolari
local dExtraCut_1 = -0.1
-- extra taglio per paralleli
local dExtraCut_2 = -0.1
-- se non ci sono tagli ortogonali devo affondare
if bNoPerpCuts_2 then
dExtraCut_2 = BD.CUT_EXTRA
end
-- taglio perpendicolare (limite Vz Down Up messo a -2 per non farlo mai intervenire)
if vCuts[i][j] then
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO_1, -2, dExtraCut_1, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
if vCuts[i+1][j] then
local bOk, sErr = FacesBySaw.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
end
end
end
end
else
nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2)
nOtInd = 3 - nUpInd
-- se prima faccia lavorata è da sotto scambio le facce
if vtN[nOtInd]:getZ() < -0.5 then
nUpInd, nOtInd = nOtInd, nUpInd
@@ -543,4 +635,4 @@ function FacesBySaw.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dRad, vtRef, dCutExt
return dLiTang, dLiPerp, dLoTang, dLoPerp
end
return FacesBySaw
return FacesBySaw
+355 -82
View File
@@ -1,5 +1,6 @@
-- MachiningLib.lua by Egaltech s.r.l. 2021/04/14
-- MachiningLib.lua by Egaltech s.r.l. 2022/05/07
-- Libreria ricerca lavorazioni per Travi
-- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste.
-- Tabella per definizione modulo
local MachiningLib = {}
@@ -17,6 +18,83 @@ local Pocketings = require( 'PocketingData')
local Sawings = require( 'SawingData')
local Drillings = require( 'DrillData')
-- tipo di teste macchina
local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T)
local TWO_EQUAL_HEADS = 2 -- due teste uguali (PF, Turn)
local TWO_UP_DOWN_HEADS = 3 -- due teste una sopra l'altra sotto (PF1250)
local MachineHeadType = 0
-- testa correntementa attiva, e utensili correnti per ogni testa
local nActiveHead = 0
local H1_TOOL = ''
local H2_TOOL = ''
-- testa e utensile della lavorazione restituita ma non ancora confermata
local nNextMachHead = 0
local H1_NEXT_TOOL = ''
local H2_NEXT_TOOL = ''
-- teste con utensili fissi
local vFixedHeads = {}
---------------------------------------------------------------------
-- funzione che imposta il tipo di macchina corrente
local function SetCurrMachineHeadType()
-- se già inizializzato, esco
if MachineHeadType and MachineHeadType >= 1 and MachineHeadType <= 3 then return end
-- altrimenti, lo imposto
if BD.DOWN_HEAD then
MachineHeadType = TWO_UP_DOWN_HEADS
elseif BD.TWO_EQUAL_HEADS then
MachineHeadType = TWO_EQUAL_HEADS
else
MachineHeadType = ONE_HEAD
end
-- imposto eventuali teste con utensili fissi
if BD.C_SIMM then
vFixedHeads = { [31] = true}
elseif BD.TURN then
vFixedHeads = { [12] = true, [22] = true}
else -- FAST
vFixedHeads = { [2] = true}
end
end
---------------------------------------------------------------------
-- funzione che conferma e rende attivi testa e utensile ipotizzati
local function ConfirmNextMachining()
-- se non definita testa successiva, esco
if not nNextMachHead or nNextMachHead < 1 or nNextMachHead > 2 then return end
-- altrimenti, la confermo come attiva
nActiveHead = nNextMachHead
if nNextMachHead == 1 then
H1_TOOL = H1_NEXT_TOOL
elseif nNextMachHead == 2 then
H2_TOOL = H2_NEXT_TOOL
end
-- reset prossima testa
nNextMachHead = 0
H1_NEXT_TOOL = ''
H2_NEXT_TOOL = ''
end
---------------------------------------------------------------------
-- funzione che traccia testa e utensile ipotizzati
local function SetNextMachining( sToolName, nHead, bFixed)
if nHead < 1 or nHead > 2 then return end
if bFixed then
nNextMachHead = 0
H1_NEXT_TOOL = ''
H2_NEXT_TOOL = ''
end
nNextMachHead = nHead
if nHead == 1 then
H1_NEXT_TOOL = sToolName
elseif nHead == 2 then
H2_NEXT_TOOL = sToolName
end
end
---------------------------------------------------------------------
local function SetCurrMachiningAndTool( sMachName)
if not EgtMdbSetCurrMachining( sMachName) then return false end
@@ -24,106 +102,301 @@ local function SetCurrMachiningAndTool( sMachName)
local sTool = EgtTdbGetToolFromUUID( sTuuid)
if not sTool then return false end
if not EgtTdbSetCurrTool( sTool) then return false end
return EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
local bActive = EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nHead = tonumber( sHead:sub( 2, #sHead))
local bH2 = ( nHead >= 21 and nHead <= 29)
local bFixed = ( vFixedHeads[nHead])
return bActive, sTool, bH2, bFixed
end
---------------------------------------------------------------------
function MachiningLib.FindCutting( sType)
for i = 1, #Cuttings do
local Cutting = Cuttings[i]
if Cutting.On and Cutting.Type == sType and SetCurrMachiningAndTool( Cutting.Name) then
return Cutting.Name
end
local function StartsWith( sStr, sStart)
if ( sStart == "" or sStr:sub( 1, #sStart) == sStart) then
return true, sStr:sub( 1, #sStr - #sStart)
else
return false, sStr
end
end
---------------------------------------------------------------------
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen)
for i = 1, #Millings do
local Milling = Millings[i]
if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then
local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not sTuuidMstr or sTuuidMstr == sTuuid) and
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
return Milling.Name, dTMaxDepth, dTDiam
local function EndsWith( sStr, sEnd)
if ( sEnd == "" or sStr:sub(-#sEnd) == sEnd) then
return true, sStr:sub(1, #sStr - #sEnd)
else
return false, sStr
end
end
---------------------------------------------------------------------
function VerifyDrill( dDiam, dDepth, bH2)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dLenTh = 72
if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end
local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE)
if dTDiam < dDiam + 10 * GEO.EPS_SMALL and
dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL and
( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) then
return true, { TMaxMat = dTMaxMat, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyDrillPocket( dDiam, dDepth, bH2)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dFreeLen = dTMaxDepth
if dTDiam < dDiam - 10 * GEO.EPS_SMALL and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) then
return true, { TMaxDepth = dTMaxDepth, MaxToolLength = dMaxToolLength, ToolDiam = dToolDiam, DiamTh = dDiamTh, FreeLen = dFreeLen, H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyMill( dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2)
local sTuuid = EgtGetMachiningParam( MCH_MP.TUUID)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not sTuuidMstr or sTuuidMstr == sTuuid) and
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
return true, { TMaxDepth = dTMaxDepth, TDiam = dTDiam, H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyPocket( dMaxDiam, dDepth, dMaxTotLen, bH2)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
return true, { TDiam = dTDiam, TMaxDepth = dTMaxDepth, H2 = bH2}
end
end
---------------------------------------------------------------------
function VerifyTool( MachiningType, sType, Params, bH2)
if MachiningType == MCH_MY.DRILLING then
if StartsWith( sType, 'Drill') then
return VerifyDrill( Params.Diam, Params.Depth, bH2)
elseif StartsWith( 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 = EndsWith( sType, '_H2')
return MachiningName, sType, EgtIf( sOrigType == 'Drill', 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 = EndsWith( sType, '_H2')
elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then
if not EndsWith( 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 = EndsWith( 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
---------------------------------------------------------------------
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen)
for i = 1, #Pocketings do
local Pocketing = Pocketings[i]
if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dTTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
if ( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not dMaxTotLen or dTTotLen < dMaxTotLen + GEO.EPS_SMALL) then
return Pocketing.Name, dTDiam, dTMaxDepth
if MachineHeadUse == TWO_EQUAL_HEADS then
-- verifico se cambiare testa o cambiare utensile su quella corrente
if nActiveHead == 1 then
if sH2Mach ~= "" then
SetNextMachining( sH2Tool, 2, bFixed)
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen
elseif sH1Mach ~= "" then
SetNextMachining( sH1Tool, 1, bFixed)
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
end
elseif nActiveHead == 2 then
if sH1Mach ~= "" then
SetNextMachining( sH1Tool, 1, bFixed)
return ReturnParams( MachiningType, sH1Mach, sType, sH1Param)
--return sH1Mach, sH1Param.Type, sH1Param.TMaxMat, sH1Param.MaxToolLength, sH1Param.ToolDiam, sH1Param.DiamTh, sH1Param.FreeLen
elseif sH2Mach ~= "" then
SetNextMachining( sH2Tool, 2, bFixed)
return ReturnParams( MachiningType, sH2Mach, sType, sH2Param)
--return sH2Mach, sH2Param.Type, sH2Param.TMaxMat, sH2Param.MaxToolLength, sH2Param.ToolDiam, sH2Param.DiamTh, sH2Param.FreeLen
end
end
end
local bH2, sOrigType = EndsWith( 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.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead)
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
end
---------------------------------------------------------------------
function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHead, bDownHead)
return FindMachining( MCH_MY.POCKETING, sType, { MaxDiam = dMaxDiam, Depth = dDepth, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
end
---------------------------------------------------------------------
function MachiningLib.FindSawing( sType)
for i = 1, #Sawings do
local Sawing = Sawings[i]
if Sawing.On and Sawing.Type == sType and SetCurrMachiningAndTool( Sawing.Name) then
return Sawing.Name
end
end
return FindMachining( MCH_MY.MORTISING, sType)
end
---------------------------------------------------------------------
function MachiningLib.FindDrilling( dDiam, dDepth, bDown)
-- ricerca sulle forature, dal diametro maggiore al minore
local sDrType = 'Drill' .. EgtIf( bDown, '_H2', '')
for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == sDrType and SetCurrMachiningAndTool( Drilling.Name) then
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dLenTh = 72
if EgtTdbGetCurrToolThLength then dLenTh = EgtTdbGetCurrToolThLength() end
local dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - dLenTh - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE)
if dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - BD.DRILL_TOL - 10 * GEO.EPS_SMALL then
if not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL then
return Drilling.Name, Drilling.Type, dTMaxMat, dMaxToolLength, dToolDiam, dDiamTh, dFreeLen
end
end
end
end
-- ricerca sulle svuotature, dal diametro maggiore al minore
local sPkType = 'Pocket' .. EgtIf( bDown, '_H2', '')
for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == sPkType and SetCurrMachiningAndTool( Drilling.Name) then
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtTdbGetCurrToolMaxDepth()
local dMaxToolLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dDiamTh = EgtTdbGetCurrToolThDiam()
local dFreeLen = dTMaxDepth
if dTDiam < dDiam - 10 * GEO.EPS_SMALL then
if not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL then
return Drilling.Name, Drilling.Type, dTMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dFreeLen
end
end
end
end
-------------------------------------------------------------------------------------------------------------
function MachiningLib.ApplyMachining( bRecalc, bApplyPost)
local bResult = EgtApplyMachining( bRecalc, bApplyPost)
if bResult then ConfirmNextMachining() end
return bResult
end
-------------------------------------------------------------------------------------------------------------
+10 -7
View File
@@ -1,5 +1,6 @@
-- ProcessBlockHausFront.lua by Egaltech s.r.l. 2020/08/03
-- Gestione calcolo giunzione block house in testa
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessBlockHausFront = {}
@@ -43,7 +44,10 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
if not dOvmTail then
dOvmTail = BD.OVM_MID
end
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -125,7 +129,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -141,7 +145,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -166,15 +170,14 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
@@ -233,7 +236,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
+2 -2
View File
@@ -75,7 +75,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -178,7 +178,7 @@ function ProcessChamfer.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
+118 -108
View File
@@ -1,4 +1,4 @@
-- ProcessCut.lua by Egaltech s.r.l. 2022/01/26
-- ProcessCut.lua by Egaltech s.r.l. 2022/06/28
-- Gestione calcolo singoli tagli di lama per Travi
-- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito.
-- 2021/06/06 Correzioni per tagli con testa da sotto.
@@ -6,6 +6,11 @@
-- 2021/09/19 Tagli da sotto non sbiechi favorita posizione da sopra di testa.
-- 2021/10/06 Piccola correzione a tagli di cubetti con testa da sotto.
-- 2022/01/26 Taglio da sotto orizzontale deve avere direzione di riferimento ortogonale -Z.
-- 2022/02/02 Modifiche per tagli di coda spostati prima come lavorazione su pezzi a caduta.
-- 2022/02/06 Correzioni per tagli di coda spostati prima.
-- 2022/05/31 Alcune modifiche per utilizzare la ProcessCut.Make in ProcessSplit e ProcessHeadCut, per le sezioni alte e larghe.
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe).
-- 2022/06/28 Modificata determinazione taglio bFromBottom in MakeFromTop.
-- Tabella per definizione modulo
local ProcessCut = {}
@@ -32,26 +37,28 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessCut.Classify( Proc, b3Raw)
-- se PF con testa da sotto, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- recupero i dati del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
if DimH > BD.MAX_DIM_DICE then
-- calcolo le massime estensioni lineari orizzontale e verticale della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
-- confronto queste estensioni con la massima dimensione del DiceCut (impossibile lavorare se entrambe maggiori)
if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
return true, true
end
end
-- verifico se c'è un taglio da sotto e se è nei limiti
-- se è un taglio da sotto, lo verifico
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then
-- calcolo l'ingombro orizzontale della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
-- confronto anche qua la distanza maggiore della faccia con la massima distanza del DiceCut
-- e se il rapporto supera il 2 (implica che genera 3 tagli) dichiaro impossibile la lavorazione
if DimH and BD.MAX_DIM_DICE and abs( BD.MAX_DIM_DICE) > 20 * GEO.EPS_SMALL and abs( DimH / BD.MAX_DIM_DICE) > 2 then
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli)
if DimH > 2 * BD.MAX_DIM_DICE then
return true, true
end
end
@@ -156,7 +163,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -179,7 +186,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -192,7 +199,7 @@ end
local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
-- eventuale segnalazione ingombro di testa o coda (se non chiamata da altre feature)
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
if ProcessCut.Identify( Proc) and Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
if Proc.Head then
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
if vtN:getZ() > 0.5 then
@@ -219,25 +226,18 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione con testa da sopra
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
b3Raw = b3Raw or EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- limiti di taglio (se molto di lato e inclinati sono permessi fino a -45deg)
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
if not BD.C_SIMM and abs( vtN:getX()) < 0.5 then dNzLimDwnUp = -0.707 end
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bFromBottom == nil then
bFromBottom = ( vtN:getZ() > 0.25 and ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtN:getX() < 0))
bFromBottom = ( vtN:getZ() > 0.25 and b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and vtN:getX() < 0 and abs( vtN:getY()) < 0.259)
end
-- verifico se da considerare taglio lungo ( non da sotto, inclinato non più di 30deg, largo come la trave e abbastanza lungo)
local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and
@@ -293,7 +293,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end
end
-- se vero taglio, eventuale inserimento smussi
if Proc.Prc == 10 then
if ProcessCut.Identify( Proc) then
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end
end
@@ -311,13 +311,20 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- determino la direzione di taglio preferenziale
local _, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0)
local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA and not bDownCut)
local bVertCutOk = ( dCutH < dMaxDepth - BD.CUT_EXTRA)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- verifico se necessari tagli supplementari
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
local vCuts = {}
if dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC then
if not Proc.AdvTail and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
local ptExtra, vtExtra
local bAutoCalcSurf = true
if bFillAreaPiece or bFillTail then
@@ -326,10 +333,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
vtExtra = X_AX()
bAutoCalcSurf = false
end
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
end
end
-- se il ProcessCut viene lanciato dal ProcessSawCut e non ci sono tagli a cubetti, esco
@@ -338,18 +345,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
local bOrthInv = false
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
if ( i % 2) == 1 then
@@ -418,9 +417,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
end
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
if not bOk then return bOk, sErr end
end
-- tutti gli altri casi vengono saltati
-- caso generale
@@ -442,28 +439,34 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end
local dVzLimDwnUp = dNzLimDwnUp
if not BD.C_SIMM and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw)
if not bOk then return bOk, sErr end
end
end
end
-- altrimenti tagli diretti della faccia
else
-- impostazioni
local dVzLimDwnUp = dNzLimDwnUp
local dCutExtra = BD.CUT_EXTRA
if Proc.AdvTail then
if bHorizCut then dVzLimDwnUp = -0.01 end
dCutExtra = -BD.ADVANCE_TAIL_OFFS
end
-- lavoro la faccia
local vtOrthoO
if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
vtOrthoO = -Z_AX()
elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or vtN:getX() > 0) then
elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or vtN:getX() > 0) then
vtOrthoO = Z_AX()
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and
vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
if Proc.Head then
vtOrthoO = X_AX()
else
vtOrthoO = -X_AX()
end
elseif vtN:getZ() < dNzLimDwnUp and abs( vtN:getY()) > 0.259 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
elseif vtN:getZ() < dVzLimDwnUp and abs( vtN:getY()) > 0.259 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
if Proc.Head then
vtOrthoO = X_AX()
else
@@ -472,16 +475,16 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
elseif Proc.Head then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
if vtN:getZ() < dVzLimDwnUp then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
end
end
-- taglio
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dNzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
-- Aggiornamento ingombro
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
return true
end
@@ -491,17 +494,11 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- se vero taglio, eventuale inserimento smussi
if Proc.Prc == 10 then
if ProcessCut.Identify( Proc) then
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end
end
@@ -519,12 +516,19 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
end
local dMaxVertDepth = dMaxDepth
-- determino la direzione di taglio preferenziale
local _, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA)
local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA) or Proc.AdvTail
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- verifico se necessari tagli supplementari
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
local vCuts = {}
if dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC then
if not Proc.AdvTail and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then
local ptExtra, vtExtra
local bAutoCalcSurf = true
if bFillAreaPiece or bFillTail then
@@ -533,22 +537,14 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
vtExtra = X_AX()
bAutoCalcSurf = false
end
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, nil ,true)
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, nil ,true)
end
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
local bOrthInv = false
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
if ( i % 2) == 1 then
@@ -627,9 +623,7 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
if vCuts[i+1][j] then
local bOk, sErr = Fbs.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
end
if not bOk then return bOk, sErr end
end
end
end
@@ -637,9 +631,9 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
else
-- lavoro la faccia
local vtOrthoO
if bHorizCut and ( b3Solid:getDimX() > BD.LEN_SHORT_PART or vtN:getX() > 0) then
if bHorizCut and ( b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or vtN:getX() > 0) then
vtOrthoO = -Z_AX()
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
if Proc.Head then
vtOrthoO = X_AX()
else
@@ -665,63 +659,79 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end
-- taglio (limite Vz Down Up messo a -2 per non farlo mai intervenire)
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, -2, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then
return bOk, sErr
local dCutExtra = BD.CUT_EXTRA
if Proc.AdvTail then
dCutExtra = min( -BD.ADVANCE_TAIL_OFFS, dMaxVertDepth - dCutV)
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, -2, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
-- Aggiornamento ingombro
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
return true
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
b3Raw = b3Raw or EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
-- dati geometrici del taglio
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- se taglio di testa
if Proc.Head then
-- se coincide con il taglio di separazione precedente, non va fatto
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
if not bForced then
if Proc.Head then
-- se coincide con il taglio di separazione precedente, non va fatto
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
return true
end
-- altrimenti taglio di coda
else
-- se coincide con taglio di separazione, non va fatto
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
return true
end
end
-- se coincide con un taglio frontale non va fatto
if Proc.CutFront 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()) < 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
-- 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
( 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
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', ''))
if not sCutting and bTopHead then
sCutting = ML.FindCutting( sCutType)
bDownHead = false
end
local sCutting
sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead)
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- se taglio con testa da sopra
if not bDownHead then
return MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
if not bDownHead and not bDownTurn then
local bOk, sErr = 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
else
return MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
if not bOk then return false, sErr end
end
-- Aggiornamento ingombro (se vero taglio o richiesto)
if ProcessCut.Identify( Proc) or bUpdateIng then
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
end
return true
end
---------------------------------------------------------------------
+1 -1
View File
@@ -69,7 +69,7 @@ function ProcessDecor.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+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
-- Tabella per definizione modulo
@@ -28,54 +28,70 @@ end
function ProcessDoubleCut.Classify( Proc, b3Raw)
--se una faccia, uso la classificazione dei tagli singoli
if Proc.Fct == 1 then return Cut.Classify( Proc, b3Raw) end
-- se PF con testa da sotto, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- limite per facce da sotto
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
-- verifico se convesso
-- determino se convesso o concavo
local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
local bConvex = ( not bAdj or ( dAng > 0))
-- se convesso
if bConvex then
-- recupero i dati di ogni singola faccia
for i = 1, 2 do
local nFac = i - 1
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFac, GDB_ID.ROOT)
if ( vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1) or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac)
if DimH > BD.MAX_DIM_DICE then
-- calcolo la massima estensione orizzontale lineare della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac, b3Raw)
-- confronto questa estensione con la massima dimensione del DiceCut (impossibile lavorare se maggiore)
if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
return true, true
end
end
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then
-- calcolo l'ingombro orizzontale della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac)
-- confronto anche qua la distanza maggiore della faccia con la massima distanza del DiceCut
-- e se il rapporto supera il 2 (implica che genera 3 tagli) dichiaro impossibile la lavorazione
if DimH and BD.MAX_DIM_DICE and abs( BD.MAX_DIM_DICE) > 20 * GEO.EPS_SMALL and abs( DimH / BD.MAX_DIM_DICE) > 2 then
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli)
if DimH > 2 * BD.MAX_DIM_DICE then
return true, true
end
end
end
return true, false
end
-- altrimenti concavo, verifico le normali delle facce per tagli da sotto
for i = 1, 2 do
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then
-- dimensione della faccia perpendicolare alla linea di intersezione tra le facce
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, 2-i, GDB_ID.ROOT)
local vtX = vtN2 ^ vtN
local frRef = Frame3d( ptC, ptC + 100 * vtX, ptC + 100 * vtN2)
local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, i-1, GDB_BB.STANDARD, frRef)
if b3Ref:getDimY() > BD.MAX_DIM_DICE then
return true, true
else
local ptC = {}
local vtN = {}
ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
local vtX = vtN[1] ^ vtN[2] ; vtX:normalize()
local vtY = { vtX ^ vtN[1], - vtX ^ vtN[2]}
for i = 1, 2 do
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN[i], vtY[i])
local bDownCut = ( vtN[i]:getZ() <= dNzLimDwnUp)
if bDownCut then
-- dimensione della faccia perpendicolarmente alla linea di intersezione tra le facce
local frRef = Frame3d( ptC[i], ptC[i] + 100 * vtX, ptC[i] + 100 * vtY[i])
local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, i-1, GDB_BB.STANDARD, frRef)
-- dimensione dell'altra faccia perpendicolarmente alla linea di intersezione tra le facce
local frRef2 = Frame3d( ptC[3-i], ptC[3-i] + 100 * vtX, ptC[3-i] + 100 * vtY[3-1])
local b3Ref2 = EgtSurfTmGetFacetBBoxRef( Proc.Id, 2-i, GDB_BB.STANDARD, frRef2)
-- se faccia grande
if b3Ref:getDimY() > BD.MAX_DIM_DICE then
-- se altra faccia piccola
if b3Ref2:getDimY() < BD.MAX_DIM_DICE then
return true, true
else
return false
end
end
end
end
return true, false
end
return true, false
end
---------------------------------------------------------------------
@@ -119,7 +135,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr)
return false, sErr
end
local sMillingDw = ML.FindMilling( 'Mark_H2')
local sMillingDw = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if bVert and not sMillingDw then
local sErr = 'Error : milling (Mark_H2) not found in library'
EgtOutLog( sErr)
@@ -141,7 +157,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -164,7 +180,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -176,7 +192,7 @@ end
-- Applicazione della lavorazione
function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se singola faccia, passo a quella lavorazione
if Proc.Fct == 1 then return Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end
if Proc.Fct == 1 then return Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true) end
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -235,9 +251,9 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
-- applico lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = 10, Box = b3Add, Fct = 1, Flg = Proc.Flg,
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
if not bOk then return bOk, sErr end
end
-- creo piano di taglio coincidente con la seconda faccia e lo lavoro
@@ -247,70 +263,18 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
-- applico lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = 10, Box = b3Add, Fct = 1, Flg = Proc.Flg,
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
if not bOk then return bOk, sErr end
end
-- altrimenti concavo
else
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -30deg)
local bTopHead = ( BD.DOWN_HEAD and vtNm:getZ() > -0.5)
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < -0.5)
-- recupero la lavorazione
-- eseguo
local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide')
local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', ''))
if not sCutting and bTopHead then
sCutting = ML.FindCutting( sCutType)
bDownHead = false
end
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dSawDiam = 400
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
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
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < BD.NZ_MINB)
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead)
if not bOk then return bOk, sErr end
-- segnalazione ingombro di testa o coda
if Proc.Head then
-- intersezioni con linee a metà altezza appena dentro dal davanti e dal dietro
+16 -13
View File
@@ -1,5 +1,6 @@
-- ProcessDovetail.lua by Egaltech s.r.l. 2021/02/04
-- Gestione calcolo giunzione coda di rondine
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessDovetail = {}
@@ -226,7 +227,7 @@ local function AddFaceToSurf( Proc, nPartId, b3Solid)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -592,7 +593,7 @@ local function MachChainFacesByBlade( Proc, nCFaceSide, nCFaceInt1, nCFaceInt2,
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 50)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 50)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -656,7 +657,7 @@ local function MakeByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3So
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -836,7 +837,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling,
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -1221,7 +1222,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
local nSCC = MCH_SCC.ADIR_YP
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -1380,7 +1381,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
end
---------------------------------------------------------------------
local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
-- recupero la geometria ausiliaria
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
@@ -1389,7 +1390,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
-- recupero il centro e la normale della faccia ausiliaria
local ptC, vtN = EgtSurfTmFacetCenter( AuxId, 0, GDB_ID.ROOT)
if not vtN then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' wrong Normal of AuxSurface'
local sErr = 'Error : wrong Normal of AuxSurface'
EgtOutLog( sErr)
return false, sErr
end
@@ -1398,7 +1399,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
-- recupero la lavorazione per la geometria ausiliaria
local sCutting = ML.FindCutting( 'HeadSide')
if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
@@ -1415,7 +1416,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -1427,7 +1428,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
return true
end
-- verifico se coincide con taglio di coda
if not bHead and AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
return true
end
-- inserisco la lavorazione
@@ -1710,7 +1711,9 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- in base al tipo di feature attribuisco il significato dei parametri Q
@@ -1735,7 +1738,7 @@ function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se ha due facce ( allora è di testa o coda)
if Proc.Fct == 2 then
-- eventuale taglio di testa o coda
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
if not bAuxOk then return bAuxOk, sAuxErr end
-- lavorazione della feature
local bOk, sErr = Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, bForceUseRough)
@@ -1743,7 +1746,7 @@ function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- se ha 3 facce ed è di testa o coda
elseif Proc.Fct == 3 and ( Proc.Head or Proc.Tail) then
-- eventuale taglio di testa o coda
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
if not bAuxOk then return bAuxOk, sAuxErr end
-- lavorazione della feature
if bForceUseRough then
+92 -49
View File
@@ -1,9 +1,16 @@
-- ProcessDrill.lua by Egaltech s.r.l. 2021/10/29
-- ProcessDrill.lua by Egaltech s.r.l. 2022/04/21
-- Gestione calcolo forature per Travi
-- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile.
-- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto.
-- 2021/09/19 DS Si premia il più possibile ricerca punta con adeguato affondamento.
-- 2021/10/29 DS MaxElev anche su fori con svuotatura.
-- 2022/03/26 DS Correzioni per fori testa-fianco nel piano.
-- 2022/03/29 DS Corretta assegnazione fori molto inclinati fianco/coda a coda.
-- 2022/04/21 DS Corretto riconoscimento fori di coda.
-- 2022/06/22 Nel riconoscimento fori di coda si utilizza ora il reale sovramateriale di coda (dOvmTail) invece di BD.OVM_MID.
-- 2022/07/01 Aggiunta gestione allungamento percorsi fori in caso di materiale già rimosso da lavorazioni precedenti
-- 2022/07/07 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda che tagliano tutta la sezione; gli Id delle feature sono nelle proprietà MachineAfterHeadCutId e MachineAfterTailCutId.
-- 2022/07/12 Aggiunto un valore minimo (10) per la distanza di sicurezza.
-- Tabella per definizione modulo
local ProcessDrill = {}
@@ -52,9 +59,11 @@ end
---------------------------------------------------------------------
-- Verifica se feature di coda
function ProcessDrill.IsTailFeature( Proc, b3Raw)
function ProcessDrill.IsTailFeature( Proc, b3Raw, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- verifico se è in coda
if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + BD.OVM_MID + BD.MAX_DIST_HTFEA then
if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + dOvmTail + BD.MAX_DIST_HTFEA then
return false
end
-- recupero e verifico l'entità foro
@@ -65,8 +74,8 @@ function ProcessDrill.IsTailFeature( Proc, b3Raw)
end
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
-- se entrata principale
if Proc.Flg == 2 or ( Proc.Flg == 1 and vtExtr:getZ() >= BD.DRILL_VZ_MIN) then
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
if ( Proc.Flg == 2 or ( Proc.Flg == 1 and vtExtr:getZ() >= BD.DRILL_VZ_MIN)) and ( nFcs == 5 or nFcs == 6 or abs( vtExtr:getX()) < BD.DRILL_VX_MAX) then
return ( ( nFcs == 5 or nFcs == 6) and vtExtr:getX() < -0.5)
-- altrimenti entrata opposta
else
@@ -117,7 +126,7 @@ function ProcessDrill.Split( Proc, b3Raw)
local bHoriz = ( abs( vtExtr:getZ()) < abs( BD.DRILL_VZ_MIN) and
( abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY() or Proc.Fce == 5 or Proc.Fce == 6))
local bSlant = ( abs( vtExtr:getX()) > BD.DRILL_VX_MAX)
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD) and not bSlant)
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and not bSlant)
end
---------------------------------------------------------------------
@@ -146,13 +155,13 @@ function ProcessDrill.Classify( Proc, b3Raw)
return false, false, false
end
local bOpen = ( Proc.Fce ~= 0)
local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD) and ( Proc.Flg == 2 or Proc.Flg == -2))))
local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and ( Proc.Flg == 2 or Proc.Flg == -2))))
-- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco
if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then
if not bOpen then
return true, true, false
else
return true, not ( BD.ROT90 or BD.DOWN_HEAD), ( BD.ROT90 or BD.DOWN_HEAD)
return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN)
end
else
return true, false, false
@@ -190,8 +199,10 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
EgtOutLog( sErr)
return false, sErr
end
-- se il foro è cieco all'inizio, lo inverto
if Proc.Fcs == 0 then bToInvert = true end
-- se il foro è cieco o troppo inclinato all'inizio, lo inverto
if Proc.Fcs == 0 or ( abs( vtExtr:getX()) > BD.DRILL_VX_MAX and Proc.Fcs ~= 5 and Proc.Fcs ~= 6) then
bToInvert = true
end
if bToInvert then vtExtr = - vtExtr end
-- se foro è splittato ed è la parte opposta, inverto
if Proc.Flg == -2 then bToInvert = true end
@@ -209,16 +220,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
local bDrillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
-- recupero la lavorazione
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillDown)
if not sDrilling and bDrillUp then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth)
end
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
if not sDrilling and dCheckDepth then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown)
if sDrilling then dCheckDepth = nil end
end
if not sDrilling and bDrillUp and dCheckDepth then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0)
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
if sDrilling then dCheckDepth = nil end
end
if not sDrilling then
@@ -232,10 +236,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nErrorCode = 2
-- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto)
else
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillDown)
if not sDrilling and bDrillUp then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0)
end
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
if not sDrilling then
nErrorCode = 1
elseif dMaxToolLength > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then
@@ -247,16 +248,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- recupero la lavorazione
local sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2
if dDepth2 > dDepth + BD.DRILL_OVERLAP then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillDown)
if not sDrilling2 and bDrillUp then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2)
end
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, dCheckDepth2, bDrillUp, bDrillDown)
if not sDrilling2 and dCheckDepth2 then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown)
if sDrilling2 then dCheckDepth2 = nil end
end
if not sDrilling2 and bDrillUp and dCheckDepth2 then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0)
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
if sDrilling2 then dCheckDepth2 = nil end
end
if not sDrilling2 then
@@ -270,10 +264,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nErrorCode = 2
-- rifaccio ricerca lavorazione senza specificare la profondità (dovrebbe trovare l'utensile più corto)
else
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillDown)
if not sDrilling2 and bDrillUp then
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0)
end
sDrilling2, sType2, dMaxDepth2, dMaxToolLength2, dToolDiam2, dDiamTh2, dToolFreeLen2 = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown)
if not sDrilling2 then
nErrorCode = 1
elseif dMaxToolLength2 > ( BD.MAX_TOOL_LEN_FOR_HOR_MACH or 300) and abs( vtExtr:getZ()) < ( BD.DRILL_VZ_MIN_LONG_TOOL or cos(10)) then
@@ -322,11 +313,14 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
EgtOutLog( sErr)
return false, sErr
end
-- conservo il valore originale di MaxDepth per poter eventualmente bypassare i check successivi
local dMaxDepthOri = dMaxDepth
-- verifico il massimo affondamento
local dSubL1 = 0
local dSubL2 = 0
local dSubL3 = 0
local dDeltaRad = ( Proc.Diam - dToolDiam) / 2
-- se foro non su testa o coda e inclinato, limito il massimo affondamento
-- se foro non su testa o coda e inclinato
local bInMid = false
local bInvertFcse = ( bToInvert and Proc.Flg ~= -2)
if ( not bInvertFcse and Proc.Fcs ~= 5 and Proc.Fcs ~= 6) or ( bInvertFcse and Proc.Fce ~= 5 and Proc.Fce ~= 6) then
@@ -339,9 +333,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
dMaxDepth = 0
end
end
-- se foro davanti o dietro e inclinato, limito il massimo affondamento
-- se foro davanti o dietro e inclinato
if dMaxDepth > 0 and abs( vtExtr:getY()) > abs( vtExtr:getZ()) then
local CosB = abs( vtExtr:getZ())
local CosB = abs( vtExtr:getY())
if bInMid then
CosB = sqrt( vtExtr:getZ() * vtExtr:getZ() + vtExtr:getX() * vtExtr:getX())
end
@@ -352,9 +346,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
dMaxDepth = 0
end
end
-- se foro sopra o sotto e inclinato, limito il massimo affondamento
-- se foro sopra o sotto e inclinato
if dMaxDepth > 0 and abs( vtExtr:getZ()) > abs( vtExtr:getY()) then
local CosB = abs( vtExtr:getY())
local CosB = abs( vtExtr:getZ())
if bInMid then
CosB = sqrt( vtExtr:getY() * vtExtr:getY() + vtExtr:getX() * vtExtr:getX())
end
@@ -387,7 +381,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if not BD.C_SIMM and not BD.TURN then
nSCC = MCH_SCC.ADIR_YM
if AreSameVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
@@ -402,18 +396,67 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nSCC = MCH_SCC.NONE
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- aggiusto l'affondamento
-- aggiusto affondamento e MaxElev
local dMaxElev = dDepth
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)
-- se c'è un taglio precedente di testa o coda posso impostare MaxElev per allungare il percorso
-- considero solo i fori "entranti" in testa o coda
if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB)
dHoleToCutDistance = vDistance[1]
-- setto MaxElev
-- il segno della distanza data dalla funzione di intersezione mi indica dove sia la geometria del foro
if bIntersectionOk then
-- se MaxDepth era stato settato a 0 per disattivare la lavorazione gli riassegno il valore originale
if dMaxDepth == 0 then
dMaxDepth = dMaxDepthOri
end
if dHoleToCutDistance > 10 * GEO.EPS_SMALL then
dMaxElev = dLen - dHoleToCutDistance
elseif dHoleToCutDistance < -10 * GEO.EPS_SMALL then
dMaxElev = -dHoleToCutDistance
end
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
-- se per qualche motivo fallisce l'intersezione torno al caso standard
else
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dMaxDepth
dMaxElev = dMaxDepth
end
-- caso standard
else
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dMaxDepth
dMaxElev = dMaxDepth
end
if sMyWarn then
EgtOutLog( sMyWarn)
end
end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10.
local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS)
local dMinStartPos = 10
local dStartPos = max( dMinStartPos, dToolDbStartPos)
EgtSetMachiningParam( MCH_MP.STARTPOS, dStartPos)
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill
local sUserNotes = 'VMRS=0;'
-- aggiungo alle note massima elevazione (coincide con affondamento)
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dDepth, 1) .. ';'
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';'
-- se foro passante, aggiungo questa qualifica alle note
if ( sType == 'Drill' or sType == 'Drill_H2') and bOpen then
sUserNotes = sUserNotes .. 'Open=1;'
@@ -426,14 +469,14 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
local bOk = EgtApplyMachining( true, false)
local bOk = ML.ApplyMachining( true, false)
if not bOk and BD.DOWN_HEAD then
if sType == 'Drill' or sType == 'Drill_H2' then
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
bOk = EgtApplyMachining( true, false)
bOk = ML.ApplyMachining( true, false)
end
if not bOk then
local _, sErr = EgtGetLastMachMgrError()
+77 -21
View File
@@ -1,10 +1,11 @@
-- ProcessDtMortise.lua by Egaltech s.r.l. 2021/12/01
-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/06/07
-- Gestione calcolo mortase a coda di rondine per Travi
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
-- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto.
-- 2021/06/28 Aggiunta gestione attacco e uscita con pocket.
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
-- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali.
-- Tabella per definizione modulo
local ProcessDtMortise = {}
@@ -59,6 +60,10 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessDtMortise.Classify( Proc)
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- recupero i dati della curva di contorno della faccia di fondo
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end
@@ -91,8 +96,9 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol
local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId)
if not NewAuxId then return end
-- ne allungo gli estremi
EgtExtendCurveStartByLen( NewAuxId, 100)
EgtExtendCurveEndByLen( NewAuxId, 100)
EgtAddCurveCompoLineTg( NewAuxId, 100, false)
EgtAddCurveCompoLineTg( NewAuxId, 100, true)
EgtMergeCurvesInCurveCompo( NewAuxId)
-- eseguo traslazione e offset per portarla sul top
local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL)
EgtMove( NewAuxId, vtMove, GDB_RT.GLOB)
@@ -118,6 +124,21 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol
return NewAuxId
end
---------------------------------------------------------------------
-- verifica che il box includa il punto in XY
function EnclosesPoint( b3Box, ptP)
if b3Box[2][1] < ptP[1] - GEO.EPS_SMALL or b3Box[1][1] > ptP[1] + GEO.EPS_SMALL then
return false
end
if b3Box[2][2] < ptP[2] - GEO.EPS_SMALL or b3Box[1][2] > ptP[2] + GEO.EPS_SMALL then
return false
end
if b3Box[2][3] < ptP[3] - GEO.EPS_SMALL or b3Box[1][3] > ptP[3] + GEO.EPS_SMALL then
return false
end
return true
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
@@ -141,15 +162,18 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
-- verifico che la mortasa non sia orientata verso il basso (-5 deg) o che ci sia una testa da sotto o un rinvio angolare
local bFaceDown = ( vtExtr:getZ() < -0.1)
if bFaceDown and not BD.DOWN_HEAD and not BD.ANG_TRASM then
if bFaceDown and not BD.DOWN_HEAD and not BD.TURN and not BD.ANG_TRASM then
local sErr = 'Machining from bottom impossible : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- determino l'altezza della mortasa (0=faccia di fondo)
local rfDtMrt = Frame3d( ptBC, vtExtr)
local rfDtMrt, dLenMrt, dWidthMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB)
local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
local dAltMort = b3DtMrt:getDimZ()
-- ne determino l'asse (valido se non pocket)
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
-- verifico se di tipo pocket
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
if bPocket then bMakeAntiSplitPath = false end
@@ -201,9 +225,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
sMchExt = '_AT'
end
-- recupero la lavorazione : prima ricerca per sola tipologia
local sMilling = ML.FindMilling( sMillType..sMchExt)
local sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
end
if not sMilling then
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
@@ -211,9 +235,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr
end
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad)
sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad)
sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown)
sMchExt = ''
end
if not sMilling then
@@ -260,14 +284,14 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
-- recupero la lavorazione
local sPocketing
sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam)
sPocketing = ML.FindPocketing( 'Mortise'..sMchExt, dToolDiam, nil, nil, bMillUp, bMillDown)
if not sPocketing and bMillUp then
sPocketing = ML.FindPocketing( 'Mortise', dToolDiam)
sPocketing = ML.FindPocketing( 'Mortise', dToolDiam, nil, nil, bMillUp, bMillDown)
end
if not sPocketing then
sPocketing = ML.FindPocketing( 'Pocket'..sMchExt, dToolDiam)
sPocketing = ML.FindPocketing( 'Pocket'..sMchExt, dToolDiam, nil, nil, bMillUp, bMillDown)
if not sPocketing and bMillUp then
sPocketing = ML.FindPocketing( 'Pocket', dToolDiam)
sPocketing = ML.FindPocketing( 'Pocket', dToolDiam, nil, nil, bMillUp, bMillDown)
end
end
if not sPocketing then
@@ -289,18 +313,27 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
-- eventuale calcolo SCC
local nSCC
if BD.TURN and not bPocket then
if abs( vtAx:getY()) > abs( vtAx:getZ()) then
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
end
-- se parametro interno abilitato e il percorso non è chiuso, aggiungo percorso e lavorazione antischeggia
if bMakeAntiSplitPath and not EgtCurveIsClosed( AuxId) then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -345,7 +378,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB)
end
if not nId1 then
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
local sErr = 'Wrong geometry : Error on DtMortise '
EgtOutLog( sErr)
return false, sErr
end
@@ -367,11 +400,15 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
-- se necessario, imposto SCC
if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end
-- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -389,10 +426,8 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
-- verifico se necessarie più passate (distanza all'imbocco ortogonale all'asse)
local vtDiff = EgtEP( AuxId, GDB_RT.GLOB) - EgtSP( AuxId, GDB_RT.GLOB)
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
local vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx
local dDist = vtOrtDiff:len()
local dDist = min( vtOrtDiff:len(), dWidthMrt)
-- calcolo le passate
local nPass = ceil( dDist / ( 1.9 * dToolDiam))
local dStep = ( dDist - 0.95 * dToolDiam) / ( 2 * nPass)
@@ -423,12 +458,33 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2)
EgtSetMachiningParam( MCH_MP.LIPERP, 5)
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
-- altrimenti verifico se sono bilanciati ingresso e uscita, per evitare inizio o fine nel legno
else
local ptS = EgtSP( AuxId, GDB_ID.ROOT)
local ptE = EgtEP( AuxId, GDB_ID.ROOT)
local dDistS = abs( ( ptS - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
local dDistE = abs( ( ptE - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
local dIni, dFin = EgtCurveDomain( AuxId)
local nCrvCnt = dFin - dIni - 1
if abs( dDistS - dDistE) > 20 then
local b3Test = BBox3d( b3Solid)
b3Test:expand( -5)
if dDistS < dDistE and EnclosesPoint( b3Test, ptS) and EgtCurveCompoAngCenter( AuxId, 0) == 0 then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dDistE - dDistS)
elseif dDistE < dDistS and EnclosesPoint( b3Test, ptE) and EgtCurveCompoAngCenter( AuxId, nCrvCnt) == 0 then
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dDistS - dDistE)
end
end
end
-- se necessario, imposto SCC
if nSCC then
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
end
-- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+34 -18
View File
@@ -1,6 +1,7 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2021/12/22
-- ProcessTenon.lua by Egaltech s.r.l. 2022/06/07
-- Gestione calcolo tenone a coda di rondine per Travi
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
-- 2022/04/14 Aumentati un poco i limiti di orientamento verso il basso per FAST e PF.
-- Tabella per definizione modulo
local ProcessDtTenon = {}
@@ -19,32 +20,41 @@ local ML = require( 'MachiningLib')
---------------------------------------------------------------------
local function VerifyOrientation( Proc, vtN, b3Raw)
-- se PF con testa da sotto, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- se trave molto bassa
if b3Raw:getDimZ() <= 120 then
if b3Raw:getDimZ() < 121 then
-- se tenone praticamente in asse, accetto fino a -45 deg
if abs( vtN:getY()) < 0.04 then
if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.7072)
-- altrimenti accetto fino a -30deg
else
return ( vtN:getZ() >= -0.51)
end
-- se trave bassa
elseif b3Raw:getDimZ() <= 200 then
elseif b3Raw:getDimZ() < 201 then
-- se tenone praticamente in asse, accetto fino a -30 deg
if abs( vtN:getY()) < 0.04 then
if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.51)
-- altrimenti accetto fino a -20deg
-- altrimenti accetto fino a -21deg
else
return ( vtN:getZ() >= -0.343)
return ( vtN:getZ() >= -0.359)
end
-- se trave medio-bassa
elseif b3Raw:getDimZ() < 281 then
-- se tenone praticamente in asse, accetto fino a -25 deg
if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.422)
-- altrimenti, accetto fino a -15 deg
else
return ( vtN:getZ() >= -0.259)
end
-- se trave media
elseif b3Raw:getDimZ() <= 350 then
elseif b3Raw:getDimZ() < 351 then
-- se tenone praticamente in asse, accetto fino a -22 deg
if abs( vtN:getY()) < 0.04 then
if abs( vtN:getY()) < 0.088 then
return ( vtN:getZ() >= -0.375)
-- altrimenti, accetto fino a -10 deg
else
@@ -102,7 +112,7 @@ local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -150,6 +160,9 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- porto inizio curva a Zmax
BL.PutStartOnTop( AuxId)
-- ne determino l'asse
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
-- se tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
if not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
( Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dOvmHead - 100 * GEO.EPS_SMALL and
@@ -222,10 +235,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- recupero la lavorazione
local sMillType = 'DtTenon'
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''))
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
@@ -295,7 +305,13 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if BD.TURN then
if abs( vtAx:getY()) > abs( vtAx:getZ()) then
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
end
elseif not BD.C_SIMM then
nSCC = MCH_SCC.ADIR_YM
if abs( vtExtr:getY()) > 0.088 then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
@@ -303,7 +319,7 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchRId, false)
return false, sErr
+5 -5
View File
@@ -418,7 +418,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -479,7 +479,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -581,7 +581,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.OFFSR, dDepthCham)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -600,7 +600,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, 0)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
@@ -680,7 +680,7 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+15 -13
View File
@@ -1,5 +1,6 @@
-- ProcessFrenchRidgeLap.lua by Egaltech s.r.l. 2020/02/11
-- Gestione calcolo giunzione francese
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessFrenchRidgeLap = {}
@@ -38,7 +39,9 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -117,25 +120,24 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dFinalExtraTrim = 0.1
local dMiddleExtraTrim = 0.3
local dNullExtraTrim = 0
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
@@ -192,7 +194,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -212,7 +214,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
+38 -8
View File
@@ -1,5 +1,7 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25
-- ProcessSplit.lua by Egaltech s.r.l. 2022/06/07
-- 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.
-- Tabella per definizione modulo
local ProcessHeadCut = {}
@@ -8,6 +10,8 @@ local ProcessHeadCut = {}
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
EgtOutLog( ' ProcessHeadCut started', 1)
@@ -109,7 +113,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -132,7 +136,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -170,10 +174,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- caratteristiche taglio
local bHorizCut = ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM)
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( b3Raw:getDimZ() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 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
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- se non obbligatorio e coincide con inizio grezzo, non va fatto
@@ -183,8 +188,33 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- determino se più tagli con offset
local nCuts = max( ceil( dOvmHead / ( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP)), 1)
local dOffsL = dOvmHead / nCuts
-- se taglio per sezioni alte e larghe
if bBigSectionCut then
if dOvmHead > 0 then
-- 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
if not bDoubleHorizCut then
elseif not bDoubleHorizCut then
-- flag di lavorazione faccia
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
-- calcolo extra taglio ed accorciamento
@@ -220,7 +250,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
else
-- recupero la lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'HeadSide_H2')
local sCutting2 = ML.FindCutting( 'HeadSide_H2', false, true)
if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr)
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
-- 2021/02/03 Corretto FaceUse con fresa orizzontale su taglio orizzontale.
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
@@ -9,6 +9,8 @@
-- 2021/10/29 Aggiunta opzione tipo lavorazione 'LongCut'.
-- 2021/11/04 Migliorata gestione sicurezza aggiuntiva in fresate di fianco (distinzione tra larga come tutta la faccia o meno).
-- 2021/11/08 Se con lama e flag BD.USE_LONGCUT si lavora in direzione contraria allo standard.
-- 2022/03/07 Razionalizzata gestione casi con fresa di fianco. Aggiunta gestione Long2Cut anche con testa sotto.
-- 2022/07/14 Aggiunta limitazione lavorazione a sinistra anche se il grezzo successivo non ha lavorazioni (finale barra) ma è abbastanza lungo da poter essere riutilizzato (BD.MinRaw).
-- Tabella per definizione modulo
local ProcessLongCut = {}
@@ -98,7 +100,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, bForcedLim,
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
EgtSetMachiningParam( MCH_MP.LOTANG, dToolDiam / 2 + 30)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -113,7 +115,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe
if sMasterCutting and #sMasterCutting > 0 then
sCutting = sMasterCutting
else
sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bMillDown, '_H2', ''))
sCutting = ML.FindCutting( 'HeadSide', not bMillDown, bMillDown)
end
if not sCutting then
local sErr = 'Error : HeadSide (cutting) not found in library'
@@ -260,7 +262,7 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacet, nFacInd, s
EgtSetMachiningParam( MCH_MP.SCC, nPrevSCC)
end
-- rieseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nIdMach, false)
return false, false, sErr
@@ -319,10 +321,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId)
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -354,34 +356,37 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
bLimXmax = true
end
end
-- Verifico lato di lavorazione (limite di lato a 45deg per pinze che schiacciano)
-- 14.07.2021 su richieste di alcuni clienti, se taglio di lato (assegnazione +/- 2) fare lo stesso con la lama lasciando il cordone centrale
-- Verifico lato di lavorazione (limite di lato a 45deg per FAST e 36deg per PF)
local nSide = 1
if vtN:getZ() < - 0.5 then
nSide = -1
elseif vtN:getY() < -0.7072 then
elseif vtN:getY() < - EgtIf( BD.C_SIMM, 0.588, 0.7072) then
nSide = -2
elseif vtN:getY() > 0.7072 then
elseif vtN:getY() > EgtIf( BD.C_SIMM, 0.588, 0.7072) then
nSide = 2
end
-- Verifico se largo come faccia
local bLarghAsFace = false
if nSide == 1 or nSide == -1 then
bLarghAsFace = ( Proc.Box:getDimY() > b3Solid:getDimY() - 10)
bLarghAsFace = ( Proc.Box:getDimY() > b3Solid:getDimY() - 20)
else
bLarghAsFace = ( Proc.Box:getDimZ() > b3Solid:getDimZ() - 10)
bLarghAsFace = ( Proc.Box:getDimZ() > b3Solid:getDimZ() - 20)
end
-- Determino se parte da sopra
local bTopStart = ( Proc.Box:getMax():getZ() > b3Solid:getMax():getZ() - 20)
-- Determino se parte da sotto
local bBottomStart = ( Proc.Box:getMin():getZ() < b3Solid:getMin():getZ() + 20)
-- determino se lavorazione da davanti o da dietro
local bFront = ( vtN:getY() < 0)
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID
local bForcedLim
local sWarn
----------------------------------------------------------------------------------------------------------------------------------------
-- 2020/09/15 Fabio Squaratti: se sono attivi entrambe i Q05 (lavorare con lama) e Q07 (lavorare con fresa di fianco anche da sopra)
-- allora vince il Q7, cioè si utilizza la fresa di fianco ( per i tagli da sopra)
-- 2020/09/17 Fabio Squaratti: se lavorazione con fresa di fianco e se ci sono delle facce laterali, l'utensile deve arrivare
-- fino al punto più vicino della faccia laterale (prima l'arretramento era sempre del rggio utensile).
-- 2020/09/17 Fabio Squaratti: se lavorazione con fresa di fianco e se ci sono delle facce terminali, l'utensile deve arrivare
-- fino al punto più vicino della faccia terminale (prima l'arretramento era sempre del raggio utensile).
-- Questo viene fatto se Q07=1 o fresa da sotto
----------------------------------------------------------------------------------------------------------------------------------------
local nUseBlade = EgtIf( bCustUseBlade, 1, EgtGetInfo( Proc.Id, 'Q05', 'i') or 0)
@@ -469,7 +474,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepthDn = 0
-- recupero la lavorazione
if bCanUseUnderBlade then
sCuttingDn = ML.FindCutting( 'HeadSide_H2')
sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true)
if not sCuttingDn then
local sErr = 'Error : sawing HeadSide_H2 not found in library'
EgtOutLog( sErr)
@@ -503,8 +508,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end
end
end
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio. setto la fine come limitata
if ( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2) and not bLimXmin then
local nNextRawId = EgtGetNextRawPart( nRawId)
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo meno distante di metà raggio, oppure se grezzo finale della barra di lunghezza sufficiente, setto la fine come limitata
if ((( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2)) or (nNextRawId and EgtGetPartInRawPartCount( nNextRawId) <= 0 and EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw)) and not bLimXmin then
if bForceUseBladeOnNotThruFace then
bForcedLim = true
bLimXmin = true
@@ -664,12 +670,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- determino la massima elevazione
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
-- recupero la lavorazione
local sMilling
if bCanUseUnderBlade then
sMilling = ML.FindMilling( 'Long2Cut_H2', dElev)
else
sMilling = ML.FindMilling( 'Long2Cut', dElev)
end
local sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bCanUseUnderBlade, bCanUseUnderBlade)
if not sMilling then
local sErr = 'Error : milling Long2Cut (_H2) not found in library'
EgtOutLog( sErr)
@@ -756,31 +757,6 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dAddExtraPerp = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
end
dLioPerp = dLioPerp + dAddExtraPerp
-------------------------------------------------------------------------------------------------------
-- disabilito questo calcolo dell'attacco perpendicolare perchè in alcune condizioni genera extra corsa
-------------------------------------------------------------------------------------------------------
--[[
-- parametri di attacco/uscita
local nOrthoOpposite = nFaceUse2
local b3Box = BBox3d( b3Raw)
b3Box:expand( BD.CUT_SIC)
-- linea o bilinea di lavorazione (qui uso nOrthoOpposite per ripetere esattamente il calcolo del Mach)
local ptP1, ptPm, ptP2, vtV1, vtV2, dLen, dWidth2 = EgtSurfTmFacetOppositeSide( Proc.Id, 0, BL.GetVersRef( nOrthoOpposite), GDB_ID.ROOT)
vtV1 = - vtV1
local bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
if bInvert then
ptP1, ptP2 = ptP2, ptP1
vtV1, vtV2 = vtV2, vtV1
end
local vtTg = ptP2 - ptP1 ; vtTg:normalize()
-- Versore di riferimento
local vtRef = Vector3d( vtTg)
local dCutExtra = 0
vtRef:rotate( vtN, EgtIf( bInvert, -90, 90))
local ptP1act = ptP1
local ptP2act = ptP2
_, dLioPerp, _, _ = Fbs.CalcLeadInOutPerpGeom( ptP1act, ptP2act, vtV1, vtV2, vtN, dToolDiam/2, vtRef, dCutExtra, b3Box)
]]--
end
-- inserisco le parti di lavorazione
nM = nM + 1
@@ -822,16 +798,6 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
if ( not bFront and k == 1) or ( bFront and k == 2) then
dSal, dEal = dEal, dSal
end
-- se faccia da sotto inverto direzione utensile e profondità
-- if nSide == -1 then
-- if k == 1 and abs( vtN:getY()) > 0.01 and abs( vtN:getY()) <= 0.866 and abs( vtN:getY()) > 0.707 then
-- -- imposto lato di correzione
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- else
-- EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
-- EgtSetMachiningParam( MCH_MP.DEPTH, dThick)
-- end
-- end
if bCanUseBlade and bCanUseUnderBlade then
EgtSetMachiningParam( MCH_MP.INVERT, true)
@@ -877,21 +843,24 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
end
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
elseif nSide ~= - 1 and nUseMillOnSide == 0 then
elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then
-- determino la massima elevazione
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Long2Cut', dElev)
local bDownHead = ( nSide == - 1)
sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut')
local sMilling = ML.FindMilling( sMchType, dElev, nil, nil, nil, not bDownHead, bDownHead)
if not sMilling then
local sErr = 'Error : milling Long2Cut not found in library'
local sErr = 'Error : milling '..sMchType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
@@ -1043,7 +1012,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dDepth = min( 0, dMaxDepth - dElev )
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -1081,9 +1050,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
nCountMilHead = nCountMilHead + 1
end
end
-- altrimenti è da sotto ( lavorazione Long2CutDown) o abilitata lavorazione con fresa di fianco ( lavorazione Long2CutSide)
-- altrimenti è con fresa di fianco (Long2CutSide) o da sotto (Long2CutDown)
else
-- da Analisi con Fabio Squaratti 15/09/2020
-- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco
local bRemoveToolRadius
-- se nExtendMach = 0 la lavorazione rimane arretrata dalla fine della faccia del raggio utensile
@@ -1091,12 +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)
local nExtendMach
-- recupero la lavorazione
local sMilling
local sMillingDn
local sPrefix
local sPrefixDn
local sMchType, sMchTypeDn
local sMilling, sMillingDn
local sPrefix, sPrefixDn
if nSide ~= - 1 then
sMilling = ML.FindMilling( 'Long2CutSide')
sMchType = 'Long2CutSide'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CS_'
nExtendMach = nUseMillOnSide
if nUseMillOnSide == 2 then
@@ -1104,30 +1073,33 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end
-- se testa da sotto
if nSide ~= 1 and BD.DOWN_HEAD then
sMillingDn = ML.FindMilling( 'Long2CutSide_H2')
sMchTypeDn = 'Long2CutSide_H2'
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CSH2_'
end
-- lavorazione da sotto
else
sMilling = ML.FindMilling( 'Long2CutDown')
else
sMchType = 'Long2CutDown'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CD_'
nExtendMach = 1
if nUseMillOnSide ~= 1 then
nExtendMach = 2 -- arretro il minimo indispensabile per non segnare il pezzo successivo (se non ha facce limite)
nExtendMach = 2 -- arretro il minimo indispensabile per non segnare il pezzo successivo (se non ha facce limite)
end
-- se testa da sotto
if BD.DOWN_HEAD then
sMillingDn = ML.FindMilling( 'Long2CutDown_H2')
sMchTypeDn = 'Long2CutDown_H2'
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CDH2_'
end
end
if not sMilling then
local sErr = 'Error : milling Long2CutSide or Long2CutDown not found in library'
if not sMilling and ( nSide == 1 or not BD.DOWN_HEAD) then
local sErr = 'Error : milling '..sMchType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
if nSide ~= 1 and BD.DOWN_HEAD and not sMillingDn then
local sErr = 'Error : milling Long2CutSide_H2 or Long2CutDown_H2 not found in library'
if not sMilling and not sMillingDn then
local sErr = 'Error : milling '..sMchType..' and '..sMchTypeDn..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
@@ -1137,9 +1109,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepth = 0
local dThDiam = 0
local dThLen = 0
local dExtraForSafety = EgtIf( BD.DOWN_HEAD, 8.5, 6.5) -- corrisponde al doppio valore di sicurezza dell'mlpe + 0.5
-- local dExtraForSafetyDn = 8.5 -- 8.5 -- corrisponde al doppio valore di sicurezza dell'mlpe + 0.5
if EgtMdbSetCurrMachining( sMilling) then
if sMilling and EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
@@ -1155,7 +1125,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dMaxDepthDn = 0
local dThDiamDn = 0
local dThLenDn = 0
if nSide ~= 1 and BD.DOWN_HEAD and EgtMdbSetCurrMachining( sMillingDn) then
if sMillingDn and EgtMdbSetCurrMachining( sMillingDn) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiamDn = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiamDn
@@ -1165,19 +1135,17 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dThLenDn = EgtTdbGetCurrToolThLength() or dThLenDn
end
end
local dDistToEnd = dToolDiam / 2
-- distanza dalle eventuali facce estreme
local dDistToEnd = dToolDiam / 2
local dDistToEndDn = dToolDiamDn / 2
-- calcolo l'elevazione della faccia principale
local dFacElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
-- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino al limite se l'elevazione della faccia è minore del raggio utensile
if nUseMillOnSide <= 1 or nSide == -1 then
if dFacElev < dDistToEnd then
dDistToEnd = sqrt( ( ( dToolDiam / 2) * ( dToolDiam / 2)) - ( ( dToolDiam / 2 - dFacElev) * (dToolDiam / 2 - dFacElev)))
end
if dFacElev < dDistToEndDn then
dDistToEndDn = sqrt( ( ( dToolDiamDn / 2) * ( dToolDiamDn / 2)) - ( ( dToolDiamDn / 2 - dFacElev) * (dToolDiamDn / 2 - dFacElev)))
end
-- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino all'estremo con l'elevazione della faccia minore del raggio utensile
if ( nUseMillOnSide <= 1 or nSide == -1) and dFacElev < dToolDiam / 2 then
dDistToEnd = sqrt( dFacElev * ( dToolDiam - dFacElev))
end
if nUseMillOnSide <= 1 and dFacElev < dToolDiamDn / 2 then
dDistToEndDn = sqrt( dFacElev * ( dToolDiamDn - dFacElev))
end
-- se la fine è già limitata allora setto per arretrare del raggio utensile
if bLimXmin then
@@ -1252,123 +1220,134 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dEndAccDist = 0
end
end
-- verifico se posso farlo da due parti opposte o da solo una parte
local dCollSic
local dCollSicMin
local dCollSicDn
local dCollSicMinDn
local dDepth
local dDepthDn
local dDepth2
local dDepth2Dn
local nPass = 1
local dNz = EgtIf( abs(nSide) == 1, vtN:getY(), vtN:getZ())
local dNzMin = EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getY(), vtN:getZ())
-- se faccia da sopra e angolo 45° o faccia da sotto e angolo 40° (con singola testa ) o faccia non da sopra e testa da sotto
-- permette di eseguire due lavorazioni opposte
if ( nSide == 1 and abs(vtN:getY()) <= 0.7072) or ( nSide == -1 and not BD.DOWN_HEAD and abs(vtN:getY()) < 0.6428) or ( nSide ~= 1 and BD.DOWN_HEAD) then
-- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica)
-- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione
local dSicOnRad
local dSicOnLegth
if ( abs(nSide) == 1 and abs(vtN:getZ()) >= abs(vtN:getY())) or ( abs(nSide) == 2 and abs(vtN:getY()) >= abs(vtN:getZ())) then
dSicOnRad = ( dThDiam + dExtraForSafety - dToolDiam) / 2
dSicOnLegth = 0
else
dSicOnRad = ( dThDiam - dToolDiam) / 2
dSicOnLegth = dExtraForSafety / 2
-- verifico se posso farlo da una sola parte o se necessario da due parti
local dMaxDepthZ = dMaxDepth
local dMaxDepthDnZ = dMaxDepthDn
local CosA = abs( vtN:getZ())
if CosA >= 0.05 then
local SinA = sqrt( 1 - CosA * CosA)
local dRad = dThDiam / 2 - dToolDiam / 2 + BD.COLL_SIC
dMaxDepthZ = dMaxDepthZ - ( dRad * CosA / SinA)
if sMillingDn then
local dRadDn = dThDiamDn / 2 - dToolDiamDn / 2
dMaxDepthDnZ = dMaxDepthDnZ - ( dRadDn * CosA / SinA)
end
dCollSicMin = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin))
if bLarghAsFace then
dCollSic = max( BD.COLL_SIC, dSicOnRad * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegth)
else
dCollSic = max( BD.COLL_SIC, dSicOnRad * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(nSide) == 1, vtN:getZ(), vtN:getY()) / dNz)) + dSicOnLegth)
end
local dMaxDepthY = dMaxDepth
local dMaxDepthDnY = dMaxDepthDn
local SinA = abs( vtN:getZ())
if SinA >= 0.05 then
local CosA = sqrt( 1 - SinA * SinA)
local dRad = dThDiam / 2 - dToolDiam / 2 + BD.COLL_SIC
dMaxDepthY = dMaxDepthY - ( dRad * CosA / SinA)
if sMillingDn then
local dRadDn = dThDiamDn / 2 - dToolDiamDn / 2
dMaxDepthDnY = dMaxDepthDnY - ( dRadDn * CosA / SinA)
end
if nSide ~= 1 and BD.DOWN_HEAD then
local dSicOnRadDn
local dSicOnLegthDn
if ( abs(nSide) == 1 and abs(vtN:getZ()) >= abs(vtN:getY())) or ( abs(nSide) == 2 and abs(vtN:getY()) >= abs(vtN:getZ())) then
dSicOnRadDn = ( dThDiamDn + dExtraForSafety - dToolDiamDn) / 2
dSicOnLegthDn = 0
end
local nPass = 0
local vdMaxD = { 0, 0}
local vnHead = { 0, 0}
-- con testa da sopra
if nSide == 1 or ( sMilling and abs( nSide) == 2 and ( bTopStart or abs( vtN:getY()) < 0.866)) or not sMillingDn then
vnHead = { 1, 1}
-- se faccia sopra
if nSide == 1 then
vdMaxD[1] = EgtIf( bLarghAsFace, dMaxDepthY, dMaxDepthZ)
if dWidth + dAgg <= vdMaxD[1] then
nPass = 1
else
dSicOnRadDn = ( dThDiamDn - dToolDiamDn) / 2
dSicOnLegthDn = dExtraForSafety / 2
nPass = 2
dAgg = BD.CUT_EXTRA_MIN
vdMaxD[2] = dMaxDepthY
end
dCollSicMinDn = max( BD.COLL_SIC, ( dThDiamDn - dToolDiamDn) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin))
if bLarghAsFace then
dCollSicDn = max( BD.COLL_SIC, dSicOnRadDn * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegthDn)
-- se altrimenti faccia sotto
elseif nSide == -1 then
if dWidth + dAgg <= dMaxDepthY or abs( vtN:getY()) > EgtIf( BD.C_SIMM, 0.588, 0.7072) then
nPass = 1
vdMaxD[1] = dMaxDepthY
else
dCollSicDn = max( BD.COLL_SIC, dSicOnRadDn * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(nSide) == 1, vtN:getZ(), vtN:getY()) / dNz)) + dSicOnLegthDn)
end
if dWidth + dAgg > dMaxDepth - dCollSic then
nPass = 2
dAgg = 1
if ( 0.5 * dWidth) + dAgg > dMaxDepth - dCollSic then
sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
end
end
if nPass == 1 and dWidth + dAgg > dMaxDepthDn - dCollSicDn then
nPass = 2
dAgg = 1
if ( 0.5 * dWidth) + dAgg > dMaxDepthDn - dCollSicDn then
sWarn = 'Warning in LongCut_2 : depth is bigger than max tool depth'
vdMaxD[1] = dMaxDepthY
local dDelta = b3Solid:getDimY() - Proc.Box:getDimY()
if bLarghAsFace then
vdMaxD[2] = min( dMaxDepthY, dMaxDepth - dDelta * abs( vtN:getZ()) - BD.COLL_SIC)
else
vdMaxD[2] = min( dMaxDepthZ, dToolLength - 5 - dDelta / abs( vtN:getZ()) - BD.COLL_SIC)
end
if vdMaxD[2] < 0 then nPass = 1 end
if nPass == 2 then dAgg = BD.CUT_EXTRA_MIN end
end
-- altrimenti faccia di fianco
else
if dWidth + dAgg > dMaxDepth - dCollSic then
nPass = 2
dAgg = 1
if ( 0.5 * dWidth) + dAgg > dMaxDepth - dCollSic then
sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
end
nPass = 1
local dDelta = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
if abs( vtN:getY()) < 0.866 then
vdMaxD[1] = dMaxDepthY
elseif bTopStart then
vdMaxD[1] = min( dMaxDepthZ, dMaxDepth - dDelta * abs( vtN:getY()) - BD.COLL_SIC)
else
vdMaxD[1] = min( dMaxDepthY, dToolLength - 5 - dDelta * abs( vtN:getY()) - BD.COLL_SIC)
end
if vdMaxD[1] < 0 then nPass = 0 end
end
-- eventuale errore per lavorazione saltata
if nPass == 0 then
local sErr = 'Error in '..sMchType..' : impossible machining'
EgtOutLog( sErr)
return false, sErr
end
-- eventuale avviso per lavorazione incompleta
if dWidth + nPass * dAgg > vdMaxD[1] + vdMaxD[2] then
sWarn = 'Warning in '..sMchType..' : depth is bigger than max tool depth'
end
-- con testa da sotto
else
-- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica)
-- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione
local dSicOnRad
local dSicOnLegth
if ( abs(nSide) == 1 and abs(vtN:getZ()) >= abs(vtN:getY())) or ( abs(nSide) == 2 and abs(vtN:getY()) >= abs(vtN:getZ())) then
dSicOnRad = ( dThDiam + dExtraForSafety - dToolDiam) / 2
dSicOnLegth = 0
vnHead = { 2, 2}
-- se faccia sotto
if nSide == -1 then
vdMaxD[1] = EgtIf( bLarghAsFace, dMaxDepthDnY, dMaxDepthDnZ)
if dWidth + dAgg <= vdMaxD[1] then
nPass = 1
else
nPass = 2
dAgg = BD.CUT_EXTRA_MIN
vdMaxD[2] = dMaxDepthDnY
end
-- altrimenti faccia di fianco
else
dSicOnRad = ( dThDiam - dToolDiam) / 2
dSicOnLegth = dExtraForSafety / 2
nPass = 1
local dDelta = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
if bBottomStart then
vdMaxD[1] = min( dMaxDepthDnZ, dMaxDepthDn - dDelta * abs( vtN:getY()) - BD.COLL_SIC)
else
vdMaxD[1] = min( dMaxDepthDnY, dToolLengthDn - 5 - dDelta * abs( vtN:getY()) - BD.COLL_SIC)
end
if vdMaxD[1] < 0 then nPass = 0 end
end
dCollSicMin = max( BD.COLL_SIC, ( dThDiam - dToolDiam) / 2 * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin))
-- dCollSic = max( BD.COLL_SIC, dSicOnRad * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, abs( EgtIf( abs(nSide) == 1, vtN:getY(), vtN:getZ()) / dNz)) + dSicOnLegth)
dCollSic = max( BD.COLL_SIC, dSicOnRad * abs( EgtIf( abs(vtN:getY()) >= abs(vtN:getZ()), vtN:getZ(), vtN:getY()) / dNzMin) + dSicOnLegth)
if dWidth + dAgg > dMaxDepth - dCollSic then
sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
end
end
-- profondità prima passata
dDepth = min( dMaxDepth - dCollSicMin, dWidth + dAgg)
-- profondità seconda passata
dDepth2 = dWidth + dAgg - dDepth
if not BD.DOWN_HEAD then
if nPass == 2 and dDepth2 < dAgg then
dDepth = min( dMaxDepth - dCollSicMin, dWidth + dAgg) / 2
dDepth2 = dWidth + dAgg - dDepth
end
end
if nSide ~= 1 and BD.DOWN_HEAD then
dDepthDn = min( dMaxDepthDn - dCollSicMinDn, dWidth + dAgg)
dDepth2Dn = dWidth + dAgg - EgtIf( abs(nSide) == 2, dDepth, dDepthDn)
if nPass == 2 and dDepth2Dn < dAgg then
dDepthDn = min( dMaxDepthDn - dCollSicMinDn, dWidth + dAgg) / 2
dDepth2Dn = dWidth + dAgg - EgtIf( abs(nSide) == 2, dDepth, dDepthDn)
-- eventuale errore per lavorazione saltata
if nPass == 0 then
local sErr = 'Error in '..sMchType..' : impossible machining'
EgtOutLog( sErr)
return false, sErr
end
-- eventuale avviso per lavorazione incompleta
if dWidth + nPass * dAgg > vdMaxD[1] + vdMaxD[2] then
sWarn = 'Warning in '..sMchType..' : depth is bigger than max tool depth'
end
end
-- profondità passate
local vdDepth = {}
vdDepth[1] = min( dWidth + dAgg, vdMaxD[1])
vdDepth[2] = min( dWidth + dAgg - vdDepth[1], vdMaxD[2])
-- ciclo sulle parti
local nM = 0
local bMakeMillHeadEnd
local bMakeMillHeadStart
local dLioPerp1 = dFacElev + BD.COLL_SIC
-- local dLioPerp2 = dWidth + BD.COLL_SIC
local dLioPerp2 = dWidth * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, sqrt( 1 - dNz * dNz) / abs( dNz)) + BD.COLL_SIC
local dLioPerp2 = dWidth * EgtIf( abs( vtN:getZ()) < GEO.EPS_SMALL, 1, sqrt( 1 - vtN:getZ() * vtN:getZ()) / abs( vtN:getZ())) + BD.COLL_SIC
-- valore sovrapposizione tra passate
local dOverLapExtend = 2
local dOverLapExtend = 2 * BD.CUT_EXTRA_MIN
for j = 1, nC do
-- Limitazioni della lavorazione
local nPos = EgtIf( bFront, j, nC - j + 1)
@@ -1376,11 +1355,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dEal = EgtIf( nPos == nC, -dStartDist, -dStartAccDist - ( nC - nPos - 1) * dC + dOverLapExtend)
-- Posizione braccio portatesta
local nSCC
local dExtraElev_1st = 0
local dExtraElevDn_1st = 0
for k = 1, nPass do
-- if EgtIf( k == 1, bFront, not bFront) then
if bFront then
nSCC = EgtIf( ( BD.C_SIMM or j == 1 or j == nC - 1), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
else
@@ -1388,31 +1363,19 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end
-- inserisco le parti di lavorazione
nM = nM + 1
local sNameF
local nMchFId
if BD.DOWN_HEAD and k == 2 and nSide ~= 1 then
sNameF = sPrefixDn .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sMillingDn)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMillingDn
EgtOutLog( sErr)
return false, sErr
end
else
sNameF = sPrefix .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
local sNameF = EgtIf( vnHead[k] ~= 2, sPrefix, sPrefixDn) .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
local nMchFId = EgtAddMachining( sNameF, EgtIf( vnHead[k] ~= 2, sMilling, sMillingDn))
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMillingDn
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
-- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto uso faccia
local nUseFace = MCH_MILL_FU.PARAL_DOWN
local nUseFace = EgtIf( vnHead[k] ~= 2, MCH_MILL_FU.PARAL_DOWN, MCH_MILL_FU.PARAL_TOP)
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then nUseFace = MCH_MILL_FU.PARAL_BACK end
EgtSetMachiningParam( MCH_MP.FACEUSE, nUseFace)
-- imposto lato di lavoro e inversione
@@ -1429,194 +1392,17 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal)
-- assegno affondamento
local dExtraElev = 0
local dExtraElevDn = 0
if not BD.DOWN_HEAD then
-- se prima lavorazione non da sotto o seconda lavorazione da sotto e componente Y <= 60° e > 0
if ( ( k == 1 and nSide ~= -1) or ( k == 2 and nSide == -1)) and abs(vtN:getY()) <= 0.866 and abs(vtN:getY()) > GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolTh = (dToolLength - EgtIf( k == 1, dDepth, ( dDepth2 + dExtraElev_1st)) - dThLen) / abs(vtN:getZ())
local dDistRadTh = dDistToolTh * abs(vtN:getY())
local dDistSurf = EgtIf( bFront, b3Solid:getMax():getY() - Proc.Box:getMax():getY(), Proc.Box:getMin():getY() - b3Solid:getMin():getY())
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) / 2) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElev = ((( dThDiam - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY()) + ( 0.5 * dExtraForSafety) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY())
end
elseif abs(dDistSurf) > GEO.EPS_SMALL then
if nSide ~= -1 then
dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
else
dDistSurf = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
end
if dDistSurf * abs(vtN:getZ()) > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getY())
end
end
-- altrimenti prima lavorazione di fianco con componente Z negativa
elseif k == 1 and abs(nSide) == 2 and vtN:getZ() > -0.866 and vtN:getZ() < - GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolTh = (dToolLength - dDepth - dThLen) / abs(vtN:getY())
local dDistRadTh = dDistToolTh * abs(vtN:getZ())
local dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) / 2) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElev = ((( dThDiam - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / abs(vtN:getZ())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) / 2) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ())
end
elseif abs( dDistSurf) < GEO.EPS_SMALL then
if bFront then
dDistSurf = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
else
dDistSurf = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
end
if dDistSurf * abs(vtN:getY()) > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getZ())
end
end
end
-- altrimenti con testa da sotto
else
-- se prima lavorazione non da sotto e componente y <= 60° e > 0
if ( k == 1 and nSide ~= -1) and abs(vtN:getY()) <= 0.866 and abs(vtN:getY()) > GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolTh = (dToolLength - dDepth - dThLen) / abs(vtN:getZ())
local dDistRadTh = dDistToolTh * abs(vtN:getY())
local dDistSurf = EgtIf( bFront, b3Solid:getMax():getY() - Proc.Box:getMax():getY(), Proc.Box:getMin():getY() - b3Solid:getMin():getY())
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getZ()) > abs(vtN:getY()) then
dExtraElev = ((( dThDiam - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY()) + ( 0.5 * dExtraForSafety) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getZ()) / abs(vtN:getY())
end
elseif abs(dDistSurf) < GEO.EPS_SMALL then
dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
if dDistSurf * vtN:getZ() > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getY())
end
end
-- se seconda lavorazione sopra e componente Z > 0
elseif k == 2 and nSide == 1 and vtN:getZ() > GEO.EPS_SMALL then
local dDistToolTh = (dToolLength - ( dDepth2 + dExtraElev_1st) - dThLen) / abs(vtN:getY())
local dDistRadTh = dDistToolTh * abs(vtN:getZ())
local dDistSurf = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) * 0.5) then
-- premio extra sicurezza su lunghezza utensile
if abs(vtN:getZ()) > abs(vtN:getY()) then
dExtraElev = ((( dThDiam - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / vtN:getZ()
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = ((( dThDiam + dExtraForSafety - dToolDiam) * 0.5) - dDistRadTh) * abs(vtN:getY()) / abs(vtN:getZ())
end
end
-- se prima lavorazione di fianco e componente Z > 0
elseif k == 1 and abs(nSide) == 2 and vtN:getZ() < GEO.EPS_SMALL then
local dDistToolTh = (dToolLength - dDepth - dThLen) / abs(vtN:getY())
local dDistRadTh = dDistToolTh * abs(vtN:getZ())
local dDistSurf = b3Solid:getMax():getZ() - Proc.Box:getMax():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurf > dDistToolTh and dDistRadTh < (( dThDiam - dToolDiam) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElev = (dDistSurf - dDistToolTh + ( 0.5 * dExtraForSafety)) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElev = (( dThDiam - dToolDiam) * 0.5) * abs(vtN:getY()) / abs(vtN:getZ()) - (dToolLength - dDepth - dThLen) + ( 0.5 * dExtraForSafety) / abs(vtN:getZ())
end
elseif abs(dDistSurf) < GEO.EPS_SMALL then
if bFront then
dDistSurf = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
else
dDistSurf = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
end
if dDistSurf * abs(vtN:getY()) > (( dThDiam + dToolDiam) * 0.5) then
dExtraElev = dDistSurf * abs(vtN:getZ())
end
end
-- se seconda lavorazione di fianco e componente Z > 0
elseif k == 2 and abs(nSide) == 2 and vtN:getZ() > GEO.EPS_SMALL then
local dDistToolThDn = (dToolLengthDn - ( dDepth2Dn + dExtraElevDn_1st) - dThLenDn) / abs(vtN:getY())
local dDistRadThDn = dDistToolThDn * abs(vtN:getZ())
local dDistSurfDn = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurfDn > dDistToolThDn and dDistRadThDn < (( dThDiamDn - dToolDiamDn) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getY()) > abs(vtN:getZ()) then
dExtraElevDn = ((( dThDiamDn - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / vtN:getZ()
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElevDn = ((( dThDiamDn + dExtraForSafety - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ())
end
elseif abs(dDistSurfDn) < GEO.EPS_SMALL then
if bFront then
dDistSurfDn = Proc.Box:getMin():getY() - b3Solid:getMin():getY()
else
dDistSurfDn = b3Solid:getMax():getY() - Proc.Box:getMax():getY()
end
if dDistSurfDn * abs(vtN:getY()) > (( dThDiamDn + dToolDiamDn) * 0.5) then
dExtraElevDn = dDistSurfDn * abs(vtN:getZ())
end
end
-- se seconda lavorazione da sotto a componente Y < 60° e Y > 0
elseif ( k == 2 and nSide == -1) and abs(vtN:getY()) <= 0.866 and abs(vtN:getY()) > GEO.EPS_SMALL then
-- verifico se può collidere in base alle dimensione del portapezzo
local dDistToolThDn = (dToolLengthDn - ( dDepth2Dn + dExtraElevDn_1st) - dThLenDn) / abs(vtN:getY())
local dDistRadThDn = dDistToolThDn * abs(vtN:getZ())
local dDistSurfDn = EgtIf( bFront, b3Solid:getMax():getY() - Proc.Box:getMax():getY(), Proc.Box:getMin():getY() - b3Solid:getMin():getY())
-- raggio portautensile e raggio utensile allora calcolo un arretramento profondità
if dDistSurfDn > dDistToolThDn and dDistRadThDn < (( dThDiamDn - dToolDiamDn) * 0.5) then
-- se devo premiare extra sicurezza su lunghezza utensile
if abs(vtN:getZ()) > abs(vtN:getY()) then
dExtraElevDn = ((( dThDiamDn - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ()) + ( 0.5 * dExtraForSafety) / abs(vtN:getY())
-- altrimenti premio extra sicurezza su raggio utensile
else
dExtraElevDn = ((( dThDiamDn + dExtraForSafety - dToolDiamDn) * 0.5) - dDistRadThDn) * abs(vtN:getY()) / abs(vtN:getZ())
end
elseif abs(dDistSurfDn) < GEO.EPS_SMALL then
dDistSurfDn = Proc.Box:getMin():getZ() - b3Solid:getMin():getZ()
if dDistSurfDn * abs(vtN:getZ()) > (( dThDiamDn + dToolDiamDn) * 0.5) then
dExtraElevDn = dDistSurfDn * abs(vtN:getY())
end
end
end
end
if BD.DOWN_HEAD and k == 2 and nSide ~= 1 then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth2Dn - dExtraElevDn)
dExtraElevDn_1st = dExtraElevDn
if dExtraElevDn > 0 and sWarn and #sWarn < 1 then
sWarn = 'Warning in LongCut_2 : depth is bigger than max tool depth'
end
else
EgtSetMachiningParam( MCH_MP.DEPTH, EgtIf( k == 1, dDepth, dDepth2) - dExtraElev)
dExtraElev_1st = dExtraElev
if dExtraElev > 0 and sWarn and #sWarn < 1 then
sWarn = 'Warning in LongCut : depth is bigger than max tool depth'
end
end
-- assegbo attacco perpendicolare
EgtSetMachiningParam( MCH_MP.DEPTH, vdDepth[k])
-- assegno attacco perpendicolare
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1)
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
-- se feature orientata su faccia da sotto provo a cambiare l'attacco
if nSide == -1 then
EgtSetMachiningParam( MCH_MP.LIPERP, min( dLioPerp1, dLioPerp2))
EgtSetMachiningParam( MCH_MP.LOPERP, min( dLioPerp1, dLioPerp2))
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
-- esco se non sono nella seconda lavorazione o non nella faccia da sotto
+156 -163
View File
@@ -1,9 +1,14 @@
-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2021/11/08
-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/06/29
-- Gestione calcolo doppio taglio longitudinale per Travi
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
-- 2021/06/29 Corretta gestione caso equivalente a due smussi.
-- 2021/10/29 Aggiunta opzione tipo lavorazione 'LongCut'.
-- 2021/11/08 Se con lama e flag BD.USE_LONGCUT si lavora in direzione contraria allo standard.
-- 2022/02/08 Sistemate lunghezze fresature quando due sole.
-- 2022/02/15 Sistemati commenti.
-- 2022/03/20 Tolta da scelta milling tipo Long2CutDown controllo max diametro fresa.
-- 2022/05/27 Corretto ordine per casi sui lati.
-- 2022/06/29 Corretto calcolo lunghezza attacco/uscita perpendicolare per lavorazioni di fianco.
-- Tabella per definizione modulo
local ProcessLong2Cut = {}
@@ -141,7 +146,7 @@ local function MakeSideFace( nId, nFac, nSide, sMilling, dToolDiam, nL2CSide)
EgtSetMachiningParam( MCH_MP.STARTPOS, 80)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -152,8 +157,9 @@ end
-- Applicazione della lavorazione
local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, dFacElev)
-- cerco la svuotatura opportuna
local sPockType = EgtIf( nSide ~=1 and BD.DOWN_HEAD, 'OpenPocket_H2', 'OpenPocket')
local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX())
local bDownHead = nSide ~=1 and BD.DOWN_HEAD
local sPockType = EgtIf( bDownHead, 'OpenPocket_H2', 'OpenPocket')
local sPocketing = ML.FindPocketing( sPockType, Proc.Box:getDimX(), nil, nil, not bDownHead, bDownHead)
if not sPocketing then
local sErr = 'Error : OpenPocket not found in library'
EgtOutLog( sErr)
@@ -194,10 +200,10 @@ local function MakeByPocketing( Proc, nPhase, nRawId, nPartId, nSide, nFacInd, d
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -250,7 +256,7 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex,
end
end
else
if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) or ( vtN2 and vtN2:getZ() >= -0.5) then
if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) and ( not vtN2 or vtN2:getZ() >= -0.5) then
bCanUseBlade = true
end
end
@@ -290,9 +296,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- verifico posizione (+1=sopra, -1=sotto, 0=sui lati)
local nSide = 0
if vtN[1]:getZ() > -10 * GEO.EPS_SMALL and vtN[2]:getZ() > -10 * GEO.EPS_SMALL then
if vtN[1]:getZ() > 0.0175 and vtN[2]:getZ() > 0.0175 then
nSide = 1
elseif vtN[1]:getZ() < 10 * GEO.EPS_SMALL and vtN[2]:getZ() < 10 * GEO.EPS_SMALL then
elseif vtN[1]:getZ() < -0.0175 and vtN[2]:getZ() < -0.0175 then
nSide = -1
end
@@ -301,39 +307,21 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local bConvex
local bOrtho
local ptM
local ptRef = ( ptC[1] + ptC[2]) / 2
if bInt then
bConvex = ( dAng >= 0)
bOrtho = ( abs( dAng + 90) < 1)
ptM = ( ptP1 + ptP2) / 2
else
bConvex = true
ptM = ptRef
local vtM1 = ptC[1] - ptM ; vtM1:normalize()
local vtM2 = ptC[2] - ptM ; vtM2:normalize()
bConvex = ( vtM1 * vtN[1] > 0 and vtM2 * vtN[2] > 0)
bOrtho = false
dAng = acos( vtN[1] * vtN[2])
ptM = ( ptC[1] + ptC[2]) / 2
-- se facce contrapposte e quindi concavo, angolo sempre negativo
if not bConvex and dAng > 0 then dAng = -dAng end
end
local ptRef = ( ptC[1] + ptC[2]) / 2
-- analisi del taglio
local vOrd = {}
local vFaceUse = {}
if nSide == 1 or ( nSide == -1 and BD.DOWN_HEAD) then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
elseif nSide == -1 then
vOrd = EgtIf( ptC[1]:getY() < ptM:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
else
local bFront = ( vtN[1]:getY() < 0)
if bFront then
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
else
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 2, 1}, { 1, 2})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
end
end
local vWidth = {}
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4
@@ -365,23 +353,41 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- verifico se posso usare lame
local bCanUseBlade, bCanUseUnderBlade = CalcBladeUse( bUseBlade, BD.DOWN_HEAD, nSide, vtN[1], vtN[2], bConvex)
-- introduco messaggi di errore in caso sia settata la lama ma impossibile utilizzarla
-- se si toglie questa parte il processo continua utilizzandi però la fresa ma per il vincolo del parametro Q non è possibile
-- se si toglie questa parte il processo continua utilizzando però la fresa ma per il vincolo del parametro Q non è possibile
if bUseBlade and not BD.DOWN_HEAD and not bCanUseBlade then
local sErr = 'Error, impossible use blade on too negative face'
EgtOutLog( sErr)
return false, sErr
-- elseif bUseBlade and not bCanUseBlade then
-- local sErr = 'Error, impossible use blade'
-- EgtOutLog( sErr)
-- return false, sErr
elseif bUseBlade and BD.DOWN_HEAD and not bCanUseBlade and not bCanUseUnderBlade then
local sErr = 'Error, impossible use blade'
EgtOutLog( sErr)
return false, sErr
end
-- analisi del taglio
local vOrd = {}
local vFaceUse = {}
if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
elseif nSide == -1 then
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
else
local bFront = ( vtN[1]:getY() < 0 or vtN[2]:getY() < 0)
if bFront then
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
else
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 2, 1}, { 1, 2})
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
end
end
local vWidth = {}
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
-- Se senza facce limitanti, da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima
-- if nFaceLimit == 0 and ( nSide == 1 or ( abs(nSide) >= 0 and BD.DOWN_HEAD)) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
if nFaceLimit == 0 and ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
local sCutting
@@ -394,7 +400,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local dMaxDepthDn = 0
-- recupero la lavorazione
if bCanUseUnderBlade then
sCuttingDn = ML.FindCutting( 'HeadSide_H2')
sCuttingDn = ML.FindCutting( 'HeadSide_H2', false, true)
if not sCuttingDn then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing underneath not found in library'
EgtOutLog( sErr)
@@ -503,8 +509,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dC = dCDn
end
-- disabilitato la selezione del codolo, prende sempre quello più piccolo. Non cancellare quello disabiliato in caso di ripristino
-- local dDimStrip = EgtIf( nSide ~= 0, BD.DIM_STRIP_SMALL, BD.DIM_STRIP)
-- uso codolo piccolo
local dDimStrip = BD.DIM_STRIP_SMALL * EgtIf( nSide == -1, -1, 1)
local nM = 0
-- se convesso lavoro ogni faccia in due metà lasciando attaccata la parte centrale
@@ -572,7 +577,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local nMchFId
local sCuttingName
local bMachDown
-- if ( k == 1 and bCanUseBlade) or ( k == 2 and ( bCanUseBlade and not bCanUseUnderBlade)) then
if bCanUseBlade and not bCanUseUnderBlade then
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCutting)
@@ -580,7 +584,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistUp
dStartAccDist = dStartAccDistUp
-- elseif ( k == 2 and bCanUseUnderBlade) or ( k == 1 and ( bCanUseUnderBlade and not bCanUseBlade)) then
elseif bCanUseUnderBlade and not bCanUseBlade then
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
@@ -677,15 +680,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dSal, dEal = dEal, dSal
end
if bCanUseBlade and bCanUseUnderBlade then
-- if bCanUseBlade and nSide == -1 then
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- else
-- EgtSetMachiningParam( MCH_MP.INVERT, true)
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- dSal, dEal = dEal, dSal
-- end
-- -- imposto uso della faccia
-- EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( k == 1, nFaceUse2, nFaceUse))
if bCanUseBlade and nSide == -1 then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- imposto uso della faccia
@@ -729,7 +723,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -768,7 +762,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- se faccia da sotto e Z centro faccia è minore del centro altra faccia, segno il limite angolare da passare
-- dovrebbe essere il limite angolare della testa 1 in sottosquadra
if nSide == -1 and not BD.DOWN_HEAD then
if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() then
if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() - 1. then
dSinLimit = -0.0157
else
dSinLimit = -0.5
@@ -858,7 +852,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- determino e imposto l'utilizzo della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]])
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -866,8 +860,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
end
end
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
elseif ( ( nSide ~= -1 or BD.DOWN_HEAD) or ( nSide == -1 and BD.DOWN_HEAD)) and nUseMillOnSide == 0 then
elseif ( nSide ~= -1 or BD.DOWN_HEAD or BD.TURN) and nUseMillOnSide == 0 then
-- determino la massima elevazione
local dElev = 0
local dFacElev1 = BL.GetFaceElevation( Proc.Id, tFaceLong[1], nPartId)
@@ -881,11 +876,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
-- recupero la lavorazione
local sMilling
if nSide == -1 and BD.DOWN_HEAD then
sMilling = ML.FindMilling( 'Long2Cut_H2', dElev)
else
sMilling = ML.FindMilling( 'Long2Cut', dElev)
end
local bDownHead = ( nSide == -1 and BD.DOWN_HEAD)
sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bDownHead, bDownHead)
if not sMilling then
local sErr = 'Error : Long2Cut not found in library'
@@ -908,10 +900,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo più distante da metà raggio. setto la fine come limitata
if dDistToNextPiece < dToolDiam/2 and nFaceLimit < 2 then
-- se ho un pezzo successivo più distante di metà raggio : setto la fine come limitata
if dDistToNextPiece < dToolDiam/2 then
bForcedLim = true
nFaceLimit = nFaceLimit + 2
nFaceLimit = nFaceLimit | 2
end
-- se chiuso e corto, applico svuotatura con fresa opportuna
if nFaceLimit == 3 and Proc.Box:getDimX() < 2 * dToolDiam then
@@ -947,10 +939,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local nIncStep = 2
if bStartFixed and bEndFixed then
dC = ( dLen - dStartAccDist - dEndAccDist) / nC
-- se distanza rimanente è < della metà del minimo della distanza estremi allora aggiungo un passo in più
-- se distanza rimanente è < della metà del minimo della distanza estremi allora aggiungo un solo passo in più
local dMinDist = EgtIf( min( dStartAccDist, dEndAccDist) / 2 > 300 , 300, min( dStartAccDist, dEndAccDist) / 2)
if dC < dMinDist then
dC = dLen / ( nC + 2)
dC = dLen / ( nC + 1)
dStartAccDist = dC
dEndAccDist = dC
nIncStep = 1
@@ -1032,6 +1024,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
end
end
if nIni == 2 then
dStartDist, dEndDist = dEndDist, dStartDist
dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist
end
-- ciclo sulle parti
local nM = 0
for j = 1, nC do
@@ -1040,7 +1036,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- valore sovrapposizione tra passate con fresa di fianco
local dOverLapExtend = 2
-- Verifico se da fare di fianco perchè normale troppo verso il basso (minore di -30deg)
local bSide = ( vtN[vOrd[i]]:getZ() < dLimitAngle and not ( nSide == -1 and BD.DOWN_HEAD))
local bSide = ( vtN[vOrd[i]]:getZ() < dLimitAngle and not ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)))
-- Limitazioni della lavorazione
local nPos = EgtIf( i == 1, j, nC - j + 1)
local dSal = EgtIf( nPos == 1, - EgtIf( i == nIni, dStartDist, dEndDist), - EgtIf( i == nIni, dStartAccDist, dEndAccDist) - ( nPos - 2) * dC + EgtIf( bSide, dOverLapExtend, 0))
@@ -1048,7 +1044,17 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- Posizione braccio portatesta
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if not BD.TURN then
nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
else
if nSide == 1 then
nSCC = EgtIf( vtN[vOrd[i]]:getY() < -0.5, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
elseif nSide == -1 then
nSCC = EgtIf( vtN[vOrd[i]]:getY() < 0, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
else
nSCC = MCH_SCC.ADIR_ZP
end
end
end
if bSide and not bConvex then
dSal, dEal = dEal, dSal
@@ -1110,7 +1116,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.STARTPOS, 80)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -1126,7 +1132,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
end
end
-- altrimenti è sotto : lavorazione Long2CutDown
-- altrimenti lavorazione di fianco : Long2CutSide o Long2CutDown
else
-- da Analisi con Fabio Squaratti 15/09/2020
-- variabile che indica se ripassare sul raggio rimasto dalla lavorazione di fianco
@@ -1136,26 +1143,27 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- se nExtendMach = 2 la lavorazione viene estesa ma arretra per non segnare il pezzo successivo (se non ha facce limite)
local nExtendMach
-- recupero la lavorazione
local sMilling
local sMillingDn
local sPrefix
local sPrefixDn
local sMchType, sMchTypeDn
local sMilling, sMillingDn
local sPrefix, sPrefixDn
if nSide ~= - 1 then
sMilling = ML.FindMilling( 'Long2CutSide')
sMchType = 'Long2CutSide'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CS_'
nExtendMach = nUseMillOnSide
if nUseMillOnSide == 2 then
bRemoveToolRadius = true
-- nExtendMach = 0 -- arretro la lavorazione del raggio utensile (se non ha facce limite)
end
-- se testa da sotto
if nSide ~= 1 and BD.DOWN_HEAD then
sMillingDn = ML.FindMilling( 'Long2CutSide_H2')
sMchTypeDn = 'Long2CutSide_H2'
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CSH2_'
end
-- lavorazione da sotto
else
sMilling = ML.FindMilling( 'Long2CutDown', nil, nil, EgtIf( nUseMillOnSide > 0, 150, 50))
else
sMchType = 'Long2CutDown'
sMilling = ML.FindMilling( sMchType)
sPrefix = 'L2CD_'
nExtendMach = 1
if nUseMillOnSide ~= 1 then
@@ -1163,17 +1171,18 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
-- se testa da sotto
if BD.DOWN_HEAD then
sMillingDn = ML.FindMilling( 'Long2CutDown_H2')
sMchTypeDn = 'Long2CutDown_H2'
sMillingDn = ML.FindMilling( sMchTypeDn, nil, nil, nil, nil, false, true)
sPrefixDn = 'L2CDH2_'
end
end
if not sMilling then
local sErr = 'Error : Long2CutSide or Long2CutDown not found in library'
if not sMilling and ( nSide == 1 or not BD.DOWN_HEAD) then
local sErr = 'Error : milling '..sMchType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
if nSide ~= 1 and BD.DOWN_HEAD and not sMillingDn then
local sErr = 'Error : Long2CutSide_H2 or Long2CutDown_H2 not found in library'
if not sMilling and not sMillingDn then
local sErr = 'Error : milling '..sMchType..' and '..sMchTypeDn..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
@@ -1263,20 +1272,43 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local nC = ceil( ( dLen - dStartAccDist - dEndAccDist) / BD.LONGCUT_MAXLEN)
local dC = 0
if nC > 0 then
local nIncStep = 2
if bStartFixed and bEndFixed then
dC = ( dLen - dStartAccDist - dEndAccDist) / nC
-- se distanza rimanente è < della metà del minimo della distanza estremi allora aggiungo un solo passo in più
local dMinDist = EgtIf( min( dStartAccDist, dEndAccDist) / 2 > 300 , 300, min( dStartAccDist, dEndAccDist) / 2)
if dC < dMinDist then
dC = dLen / ( nC + 1)
dStartAccDist = dC
dEndAccDist = dC
nIncStep = 1
elseif dC < min( dStartAccDist, dEndAccDist) then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
elseif bStartFixed then
dC = ( dLen - dStartAccDist) / ( nC + 1)
dEndAccDist = dC
if dC < dStartAccDist then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
elseif bEndFixed then
dC = ( dLen - dEndAccDist) / ( nC + 1)
dStartAccDist = dC
if dC < dEndAccDist then
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
else
dC = dLen / ( nC + 2)
dStartAccDist = dC
dEndAccDist = dC
end
nC = nC + 2
nC = nC + nIncStep
else
if dLen > min( dStartAccDist, dEndAccDist) then
nC = 2
@@ -1377,7 +1409,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
if BD.DOWN_HEAD and nSide ~= 1 then
local ptC3 = EgtSurfTmFacetCenter( Proc.Id, tFaceLong[vOrd[i]], GDB_ID.ROOT)
local ptDir = ptC3 - ptM ; ptDir:normalize()
-- se concave e dal versore Z della faccia (> -20°) o convesso e versore Z ( > -30°) decido se eseguire la lavoraione con la testa d a sopra o da sotto
-- se concave e dal versore Z della faccia (> -20°) o convesso e versore Z ( > -30°) decido se eseguire la lavoraione con la testa da sopra o da sotto
if ( not bConvex and vtN[vOrd[i]]:getZ() > -0.9397 and ptDir:getZ() > 0) or
( bConvex and vtN[vOrd[i]]:getZ() > -0.866 and ptDir:getZ() > 0) then
sNameF = sPrefix .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nM)
@@ -1417,64 +1449,41 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- se fresa di fianco e non da sotto
if nUseMillOnSide > 0 and nSide ~= -1 then
-- se faccia da sopra o di fianco
if nSide >= 0 then
if bConvex then
local vFaceUse2
-- se da sopra
if nSide == 1 then
if vtN[vOrd[i]]:getZ() > 0.866 then
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 1, 2)], vtN[EgtIf(vOrd[i] == 1, 2, 1)])
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
-- EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_TOP)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
end
-- altrimenti è di fianco
if bConvex then
local vFaceUse2
-- se da sopra
if nSide == 1 then
if vtN[vOrd[i]]:getZ() > 0.866 then
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 1, 2)], vtN[EgtIf(vOrd[i] == 1, 2, 1)])
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else
if vtN[vOrd[i]]:getY() > 0.866 then
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_TOP)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
end
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
end
-- se concavo
-- altrimenti è di fianco
else
local vFaceUse2
-- se da sopra
if nSide == 1 then
-- vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)])
-- altrimenti è di fianco
if vtN[vOrd[i]]:getY() > 0.866 then
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_TOP)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
else
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
end
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
end
-- questa parte non viene mai eseguita
-- se faccia da sotto
-- else
-- if bConvex then
-- EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
-- if vtN[vOrd[i]]:getZ() >= 0 then
-- EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
-- EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
-- end
-- else
-- -- lascio lo stesso le lavorazioni anche se viene intercettato l'errore
-- local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
-- EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
-- if vtN[vOrd[i]]:getZ() < 0 then
-- EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
-- EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
-- end
-- end
-- se concavo
else
local vFaceUse2
-- se da sopra
if nSide == 1 then
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)])
-- altrimenti è di fianco
else
vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
end
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
end
else
-- se con fresa di fianco
@@ -1492,7 +1501,6 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
else
-- lascio lo stesso le lavorazioni anche se viene intercettato l'errore
-- local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)])
local vFaceUse2 = BL.GetNearestParalOpposite( vtN[EgtIf(vOrd[i] == 1, 2, 1)], vtN[EgtIf(vOrd[i] == 1, 1, 2)])
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse2)
if vtN[vOrd[i]]:getZ() < 0 then
@@ -1518,14 +1526,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- local dNz = EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())
local dNz = EgtIf( abs(nSide) == 1, vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())
local dNzMin = EgtIf( abs(vtN[vOrd[i]]:getY()) >= abs(vtN[vOrd[i]]:getZ()), vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ())
local dLioPerp1, dLioPerp2
-- nel caso concavo, devo impostare la lunghezza di attacco ortogonale
if not bConvex then
dLioPerp1 = EgtIf( i == 1, dFacElev1, dFacElev2)
-- dLioPerp1 = vWidth[vOrd[i]] * EgtIf( abs(dNz) < GEO.EPS_SMALL, 1, sqrt( 1 - dNz * dNz) / abs( dNz)) + BD.COLL_SIC
dLioPerp2 = vWidth[ EgtIf( vOrd[i] == 1, 2,1)] + BD.COLL_SIC
EgtSetMachiningParam( MCH_MP.LIPERP, max( dLioPerp1, dLioPerp2))
EgtSetMachiningParam( MCH_MP.LOPERP, max( dLioPerp1, dLioPerp2))
local dLioPerp = EgtIf( i == 1, dFacElev1, dFacElev2) + BD.COLL_SIC
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp)
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
end
-- verifico massimo affondamento (tengo conto dell'inclinazione utensile e della pinza con estremità conica)
-- 08/09/2020 tolti i 3mm ( per la ghiera smussata) perchè nella verifica collisione vine creato un cilindro non smussato che rileva la collisione
@@ -1553,23 +1558,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dDepth2 = vWidth[vOrd[i]] + dAgg - dDepth
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth - dExtraElev)
end
-- EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- eseguo
if not EgtApplyMachining( true, false) then
-- se feature orientata su faccia da sotto e concave provo a cambiare l'attacco
if nSide == -1 and not bConvex then
EgtSetMachiningParam( MCH_MP.LIPERP, dLioPerp1)
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp1)
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
else
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- se facce principali convesse, eventuale lavorazione della faccia limitante l'inizio (a destra)
if bConvex and j == 1 and not bStartFixed and bRemoveToolRadius then
+6 -9
View File
@@ -1,4 +1,4 @@
-- ProcessMark.lua by Egaltech s.r.l. 2021/05/03
-- ProcessMark.lua by Egaltech s.r.l. 2022/06/07
-- Gestione calcolo marcatura per Travi
-- 2020/05/28 Tipo di lavorazione passato da Mark a Text.
-- 2021/05/03 Aggiunta gestione testa da sotto.
@@ -60,7 +60,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
return false, sErr
end
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD then
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible'
EgtOutLog( sErr)
return false, sErr
@@ -70,11 +70,8 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- recupero la lavorazione
local sMillType = 'Text'
local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType..sMchExt)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
--local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr)
@@ -97,7 +94,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -121,7 +118,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchF2Id, false)
return false, sErr
+5 -5
View File
@@ -198,7 +198,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -236,14 +236,14 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
local sPocketing
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
sPocketing = ML.FindPocketing( sPockType, dW)
end
end
if not sPocketing then
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
sPocketing = ML.FindPocketing( sPockType, dW)
end
@@ -321,7 +321,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';')
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -362,7 +362,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( (-nDepthMin+BD.CUT_EXTRA), 1) .. ';')
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+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
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2021/10/12 Estesa gestione di testa da sotto, se presente.
-- 2021/10/12 Portato a 30deg l'angolo limite per fare l'antischeggia.
-- 2022/01/26 Migliorato controllo lavorazione con fresa su testa da sotto.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo
local ProcessProfCamb = {}
@@ -13,6 +16,7 @@ local ProcessProfCamb = {}
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfCamb started', 1)
@@ -62,6 +66,12 @@ function ProcessProfCamb.Classify( Proc, b3Raw)
end
end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfCamb.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtNF)
-- comincio con la normale a 45deg
@@ -128,7 +138,7 @@ local function ModifySideAndInvert( Proc, bHead, bForceInvert, nCutLengthMach)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, nCutLengthMach)
end
-- riapplico la lavorazione
EgtApplyMachining( true, false)
ML.ApplyMachining( true, false)
end
end
end
@@ -140,12 +150,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then
if dDepth > 0.1 then
nChamfer = 1
end
-- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then
if nChamfer == 1 then
nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco
else
@@ -174,19 +184,15 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
-- recupero la lavorazione
local sMilling, sMilling2
if nChamfer > 0 then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP then
sMilling = ML.FindMilling( 'Mark_H2')
if not sMilling then sMilling = ML.FindMilling( 'Mark') end
else
sMilling = ML.FindMilling( 'Mark')
end
local bDownHead = BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead)
if not sMilling then
local sErr = 'Error : chamfer not found in library'
EgtOutLog( sErr)
return -1, 0, sErr
end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2')
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr)
@@ -201,6 +207,7 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -272,28 +279,43 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bMakeAs = true
end
end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
-- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then
-- aggiungo taglio di lama di sgrossatura e lo lavoro
-- aggiungo piano di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtNF)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then return bOk, sErr end
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
-- recupero la lavorazione
local sPockType = 'OpenPocket'
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end
-- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama
-- recupero la lavorazione di fresatura
local sMillType = 'Prof'
sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''))
if not sMilling and bMillDown then
sMilling = ML.FindMilling( sMillType)
bMillDown = false
end
sMilling, _, _, bMillDown = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown)
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr)
@@ -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
-- recupero la lavorazione
local sCutType = 'HeadSide'
local sCutting = ML.FindCutting( sCutType .. EgtIf( bMillDown, '_H2', ''))
local sCutting = ML.FindCutting( sCutType, not bMillDown, bMillDown)
-- se richiesto taglio con lama da sotto e non trovato non posso utilizzare quello da sopra
if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' sawing not found in library'
@@ -383,7 +405,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -430,7 +452,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -444,9 +466,124 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se il chamfer non è esclusivo continuo con le altre lavorazioni
if nChamfer < 2 then
-- verifico se necessario lavorare in doppio
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- inserisco la lavorazione
-- se lavorazione da due parti, aggiungo la seconda
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
else
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName
if bMakeAs then
sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
else
sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
end
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione
ModifySideAndInvert( Proc, bHead)
end
-- se devo fare l'antischeggia in testa
if bMakeAs then
local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
-- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale)
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
-- rendo corrente la precedente, la inverto e modifico il parametri di uscita
EgtSetCurrMachining( nMchId)
local dCrvLen = EgtCurveLength( AuxId)
if dCrvLen > abs(dMakeAntiSplintOnHead) then
ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen))
end
-- rendo corrente la copia (cioè la lavorazione completa)
EgtSetCurrMachining( nMch2Id)
nMchId = nMch2Id
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName
if bMakeAs then
sName = 'Prof_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -509,7 +646,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -547,92 +684,13 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName
if bMakeAs then
sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
else
sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
end
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione
ModifySideAndInvert( Proc, bHead)
end
-- se devo fare l'antischeggia in testa
if bMakeAs then
local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
-- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale)
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
-- rendo corrente la precedente, la inverto e modifico il parametri di uscita
EgtSetCurrMachining( nMchId)
local dCrvLen = EgtCurveLength( AuxId)
if dCrvLen > abs(dMakeAntiSplintOnHead) then
ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen))
end
-- rendo corrente la copia (cioè la lavorazione completa)
EgtSetCurrMachining( nMch2Id)
nMchId = nMch2Id
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se non da sotto e parametro Q abilitato, inserisco lavorazione finitura angolo
if ( nSide ~= -1 or bMillDown) and EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') == 1 then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -663,7 +721,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false)
return false, sErr
@@ -685,7 +743,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end
end
return true
return true, sWarn
end
---------------------------------------------------------------------
+157 -91
View File
@@ -1,7 +1,10 @@
-- ProcessProfConcave.lua by Egaltech s.r.l. 2021/06/28
-- ProcessProfConcave.lua by Egaltech s.r.l. 2022/05/28
-- Gestione calcolo profilo concavo per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo
local ProcessProfConcave = {}
@@ -9,6 +12,7 @@ local ProcessProfConcave = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfConcave started', 1)
@@ -55,6 +59,12 @@ function ProcessProfConcave.Classify( Proc, b3Raw)
end
end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfConcave.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN)
-- comincio con la normale a 45deg
@@ -82,8 +92,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
-- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione
ptSP = EgtGetMachiningStartPoint()
ptEp = EgtGetMachiningEndPoint()
local ptSP = EgtGetMachiningStartPoint()
local ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
@@ -116,7 +126,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end
-- riapplico la lavorazione
EgtApplyMachining( true, false)
ML.ApplyMachining( true, false)
end
end
@@ -127,12 +137,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then
if dDepth > 0.1 then
nChamfer = 1
end
-- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then
if nChamfer == 1 then
nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco
else
@@ -164,7 +174,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark')
if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then
sMilling = ML.FindMilling( 'Mark_H2')
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
end
if not sMilling then
local sErr = 'Error : chamfer not found in library'
@@ -173,7 +183,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end
end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2')
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr)
@@ -188,6 +198,7 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -249,19 +260,38 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then
return false, sChamfer
end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
-- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then
-- aggiungo taglio di lama di sgrossatura e lo lavoro
-- aggiungo piano di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then return bOk, sErr end
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
-- recupero la lavorazione
local sPockType = 'OpenPocket'
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end
end
-- se devo inserire il chamfer
@@ -321,7 +351,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -371,7 +401,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -404,9 +434,109 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
end
-- verifico se necessario lavorare in doppio
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- inserisco la lavorazione
-- se lavorazione da due parti, aggiungo la seconda
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
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)
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
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, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
@@ -460,7 +590,6 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -470,7 +599,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -484,7 +613,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if bFinish then
-- inserisco la lavorazione
local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
@@ -494,80 +623,17 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchVId = EgtAddMachining( sName, sMilling)
if not nMchVId then
@@ -594,7 +660,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false)
return false, sErr
@@ -603,7 +669,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchV2Id = EgtAddMachining( sName, sMilling)
if not nMchV2Id then
@@ -627,7 +693,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false)
return false, sErr
@@ -649,7 +715,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end
end
return true
return true, sWarn
end
---------------------------------------------------------------------
+156 -90
View File
@@ -1,7 +1,10 @@
-- ProcessProfConvex.lua by Egaltech s.r.l. 2021/06/28
-- ProcessProfConvex.lua by Egaltech s.r.l. 2022/05/28
-- Gestione calcolo profilo convesso per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo
local ProcessProfConvex = {}
@@ -9,6 +12,7 @@ local ProcessProfConvex = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfConvex started', 1)
@@ -55,6 +59,12 @@ function ProcessProfConvex.Classify( Proc, b3Raw)
end
end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfConvex.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN)
-- comincio con la normale a 45deg
@@ -82,8 +92,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
-- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione
ptSP = EgtGetMachiningStartPoint()
ptEp = EgtGetMachiningEndPoint()
local ptSP = EgtGetMachiningStartPoint()
local ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
@@ -116,7 +126,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end
-- riapplico la lavorazione
EgtApplyMachining( true, false)
ML.ApplyMachining( true, false)
end
end
@@ -127,12 +137,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then
if dDepth > 0.1 then
nChamfer = 1
end
-- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then
if nChamfer == 1 then
nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco
else
@@ -164,7 +174,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark')
if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then
sMilling = ML.FindMilling( 'Mark_H2')
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
end
if not sMilling then
local sErr = 'Error : chamfer not found in library'
@@ -173,7 +183,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end
end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2')
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr)
@@ -188,6 +198,7 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -249,19 +260,38 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then
return false, sChamfer
end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
-- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then
-- aggiungo taglio di lama di sgrossatura e lo lavoro
-- aggiungo piano di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then return bOk, sErr end
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
-- recupero la lavorazione
local sPockType = 'OpenPocket'
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end
end
-- se devo inserire il chamfer
@@ -321,7 +351,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -371,7 +401,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -404,9 +434,109 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
end
-- verifico se necessario lavorare in doppio
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- inserisco la lavorazione
-- se lavorazione da due parti, aggiungo la seconda
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
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)
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
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, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
@@ -460,7 +590,6 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -470,7 +599,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -494,80 +623,17 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchVId = EgtAddMachining( sName, sMilling)
if not nMchVId then
@@ -594,7 +660,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false)
return false, sErr
@@ -603,7 +669,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchV2Id = EgtAddMachining( sName, sMilling)
if not nMchV2Id then
@@ -627,7 +693,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false)
return false, sErr
@@ -648,7 +714,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end
end
return true
return true, sWarn
end
---------------------------------------------------------------------
+150 -83
View File
@@ -1,7 +1,10 @@
-- ProcessProfFront.lua by Egaltech s.r.l. 2021/06/28
-- ProcessProfFront.lua by Egaltech s.r.l. 2022/05/28
-- Gestione calcolo profilo frontale per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo
local ProcessProfFront = {}
@@ -9,6 +12,7 @@ local ProcessProfFront = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfFront started', 1)
@@ -55,6 +59,12 @@ function ProcessProfFront.Classify( Proc, b3Raw)
end
end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfFront.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN)
local vtNP = Vector3d( vtN)
@@ -87,7 +97,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam)
local bInvertMode = EgtGetMachiningParam( MCH_MP.INVERT)
EgtSetMachiningParam( MCH_MP.INVERT, not bInvertMode)
-- riapplico la lavorazione
EgtApplyMachining( true, false)
ML.ApplyMachining( true, false)
end
end
end
@@ -99,12 +109,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then
if dDepth > 0.1 then
nChamfer = 1
end
-- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then
if nChamfer == 1 then
nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco
else
@@ -136,7 +146,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
sMilling = ML.FindMilling( 'Mark')
if not sMilling then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 then
sMilling = ML.FindMilling( 'Mark_H2')
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
end
if not sMilling then
local sErr = 'Error : chamfer not found in library'
@@ -145,7 +155,7 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
end
end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2')
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr)
@@ -160,6 +170,7 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sWarn
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -220,19 +231,38 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then
return false, sChamfer
end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
-- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then
-- aggiungo taglio di lama di sgrossatura e lo lavoro
-- aggiungo piano di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then return bOk, sErr end
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
-- recupero la lavorazione
local sPockType = 'OpenPocket'
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end
end
-- se devo inserire il chamfer
@@ -282,7 +312,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -330,7 +360,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -363,8 +393,104 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
end
-- verifico se necessario lavorare in doppio
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- se lavorazione da due parti, aggiungo la seconda
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
else
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
@@ -413,7 +539,6 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -423,7 +548,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -447,77 +572,17 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then
-- se non da sotto, inserisco lavorazione finitura angolo
--if nSide ~= -1 then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -540,7 +605,9 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
-- imposto tipo uso faccia
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
if nSide ~= 1 then
if nSide == -1 then
nFaceUse = EgtIf( vtN:getX() > 0.1, MCH_MILL_FU.PARAL_LEFT, MCH_MILL_FU.PARAL_RIGHT)
elseif nSide ~= 1 then
nFaceUse = EgtIf( vtN:getY() > 0.1, MCH_MILL_FU.PARAL_FRONT, MCH_MILL_FU.PARAL_BACK)
end
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
@@ -551,7 +618,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false)
return false, sErr
@@ -580,7 +647,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX())
-- end
--end
return true
return true, sWarn
end
---------------------------------------------------------------------
+154 -98
View File
@@ -1,8 +1,11 @@
-- ProcessProfHead.lua by Egaltech s.r.l. 2021/10/12
-- ProcessProfHead.lua by Egaltech s.r.l. 2022/05/28
-- Gestione calcolo profilo di testa per Travi
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa sotto.
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
-- 2021/10/12 Estesa gestione di testa da sotto, se presente.
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- Tabella per definizione modulo
local ProcessProfHead = {}
@@ -10,6 +13,7 @@ local ProcessProfHead = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessProfHead started', 1)
@@ -56,6 +60,12 @@ function ProcessProfHead.Classify( Proc, b3Raw)
end
end
---------------------------------------------------------------------
-- Verifico se richiesto il solo smusso
function ProcessProfHead.OnlyChamfer( Proc)
return (( EgtGetInfo( Proc.Id, sDepthChamferMill, 'd') or 0) > 0.1 and EgtGetInfo( Proc.Id, sPreemptiveChamfer, 'i') == 1)
end
---------------------------------------------------------------------
local function GetSawCutData( AuxId, vtN)
-- assegno la normale
@@ -75,8 +85,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
-- confronto il punto iniziale e finale della lavorazione con il box della feature
-- e se è vicino alla parte esterna della trave inverto la lavorazione
ptSP = EgtGetMachiningStartPoint()
ptEp = EgtGetMachiningEndPoint()
local ptSP = EgtGetMachiningStartPoint()
local ptEp = EgtGetMachiningEndPoint()
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
if nMachMode == 1 and ptSP and ptEp then
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
@@ -109,7 +119,7 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen)
end
-- riapplico la lavorazione
EgtApplyMachining( true, false)
ML.ApplyMachining( true, false)
end
end
@@ -120,12 +130,12 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
local b3Raw = EgtGetRawPartBBox( nRawId)
-- verifico che lo smusso sia richiesto
local dDepth = EgtGetInfo( Proc.Id, sDephtCham, 'd') or 0
if dDepth > 0 then
if dDepth > 0.1 then
nChamfer = 1
end
-- verifico se posso fare solo lo smusso
if EgtGetInfo( Proc.Id, sOnlyCham, 'i') == 1 then
if dDepth > 0 then
if nChamfer == 1 then
nChamfer = nChamfer + 1
-- altrimenti se non ho l'affondamento esco
else
@@ -154,19 +164,15 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly
-- recupero la lavorazione
local sMilling, sMilling2
if nChamfer > 0 then
if BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP then
sMilling = ML.FindMilling( 'Mark_H2')
if not sMilling then sMilling = ML.FindMilling( 'Mark') end
else
sMilling = ML.FindMilling( 'Mark')
end
local bDownHead = BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1 and BD.DH_MAX_TOP and ( Proc.Box:getMax():getZ() - b3Raw:getMax():getZ()) < BD.DH_MAX_TOP
sMilling = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, true, bDownHead)
if not sMilling then
local sErr = 'Error : chamfer not found in library'
EgtOutLog( sErr)
return -1, 0, sErr
end
if BD.DOWN_HEAD and abs( vtExtr:getZ()) > 0.9 then
sMilling2 = ML.FindMilling( 'Mark_H2')
sMilling2 = ML.FindMilling( 'Mark_H2', nil, nil, nil, nil, false, true)
if not sMilling2 then
local sErr = 'Error : chamfer2 not found in library'
EgtOutLog( sErr)
@@ -256,19 +262,38 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 0 then
return false, sChamfer
end
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
-- se smusso non è esclusivo, aggiungo sgrossatura
if nChamfer < 2 then
-- aggiungo taglio di lama di sgrossatura e lo lavoro
-- aggiungo piano di sgrossatura e lo lavoro
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- applico la lavorazione
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then return bOk, sErr end
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
-- recupero la lavorazione
local sPockType = 'OpenPocket'
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
-- altrimenti applico taglio di lama
else
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
if not bOk then
return false, sErr
end
end
end
end
-- se devo inserire il chamfer
@@ -328,7 +353,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -380,7 +405,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -396,10 +421,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
if nChamfer < 2 then
-- recupero la lavorazione
local sMillType = 'Prof'
local sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown, '_H2', ''))
if not sMilling then
sMilling = ML.FindMilling( sMillType)
end
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bMillDown)
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
@@ -418,9 +440,108 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
end
-- verifico se necessario lavorare in doppio
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
-- inserisco la lavorazione
-- se lavorazione da due parti, aggiungo la seconda
local sMillingDown
if bDouble then
if nSide == 0 then
if BD.DOWN_HEAD then
-- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then
sWarn = 'Warning : milling from bottom not found in library'
EgtOutLog( sWarn)
bDouble = false
end
else
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
bDouble = false
end
end
end
-- se orizzontale o trovata lavorazione per doppio verticale
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- se lavorazione da sopra e da sotto
if ( nSide == 0) then
if vtExtr:getZ() > 0.1 then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
-- altrimenti lavorazione davanti e dietro
else
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
end
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
bFinish = true
end
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- inserisco la prima lavorazione
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
@@ -474,7 +595,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local ptSP, ptEp
local bFinish
local dOriOffset = 0
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
@@ -484,7 +604,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
bFinish = true
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -509,77 +629,13 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
-- se lavorazione da due parti, aggiungo la seconda
if bDouble then
-- inserisco la lavorazione
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- resetto il flag inversione percorso
bFlagInvert = false
-- sempre lavorazione da sopra o da sotto
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
if ( bHead and vtExtr:getY() > 0.1) or
( not bHead and vtExtr:getY() < -0.1) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
EgtSetMachiningParam( MCH_MP.INVERT, true)
bFlagInvert = not bFlagInvert
end
-- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
if dOffsetPar > 0 then
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
-- e uscita
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
end
-- se abilitata, aggiungo lavorazione di finitura
if bFinish then
-- inserisco la lavorazione
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
if not nMch2Id then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
else
-- riporto il sovramateriale originale e tolgo i passi inutili
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMch2Id, false)
return false, sErr
end
end
end
end
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and #vAngs > 0 then
@@ -618,7 +674,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchV2Id, false)
return false, sErr
@@ -658,7 +714,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchVId, false)
return false, sErr
@@ -681,7 +737,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
end
end
return true
return true, sWarn
end
---------------------------------------------------------------------
+9 -10
View File
@@ -97,7 +97,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- determino se da lavorare con testa da sotto
local bDownHead = ( BD.DOWN_HEAD and vtN[vFaceOrd[3]]:getZ() < -0.1)
-- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide' .. EgtIf( bDownHead, '_H2', ''))
local sCutting = ML.FindCutting( 'HeadSide', not bDownHead, bDownHead)
if not sCutting then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
EgtOutLog( sErr)
@@ -137,23 +137,22 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOk then return bOk, sErr end
end
end
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
end
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
+1 -1
View File
@@ -230,7 +230,7 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
+8 -5
View File
@@ -1,5 +1,6 @@
-- ProcessSawCut.lua by Egaltech s.r.l. 2021/01/15
-- ProcessSawCut.lua by Egaltech s.r.l. 2022/03/07
-- Gestione calcolo taglio di lama per Travi
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessSawCut = {}
@@ -31,12 +32,14 @@ function ProcessSawCut.Classify( Proc, b3Raw)
if not AuxId then return false end
AuxId = AuxId + Proc.Id
local vtDir = EgtSV( AuxId, GDB_ID.ROOT)
return true, ( vtDir:getZ() <= - 0.088)
return true, ( vtDir:getZ() <= - 0.5)
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -71,7 +74,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- altrimenti taglio di coda
else
-- se coincide con taglio di separazione, non va fatto
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
return true
end
end
@@ -219,7 +222,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+27 -13
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
-- 2021/06/28 Aggiunto extra-taglio alle lamate orizzontali.
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- 2022/07/12 Aggiunta gestione PF1250 e TURN.
-- Tabella per definizione modulo
local ProcessScarfJoint = {}
@@ -26,6 +28,10 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function ProcessScarfJoint.Classify( Proc)
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
return true
end
-- verifico le normali delle facce
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
for i = 1, nFacetCnt do
@@ -92,7 +98,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -115,7 +121,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -126,10 +132,10 @@ end
---------------------------------------------------------------------
local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim)
local vCuts = {}
local bOk = true
local sErr = ''
local vCuts = {}
if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then
-- lavoro solo la faccia inclinata perché la faccia tappo completa la lavoro successivamente
-- questo evita di lavorare due volte la faccia tappo
@@ -138,6 +144,8 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[4]], vtN[vFaceOrd[4]], true, nil, nil, nil, dNewDiceDim)
end
local dVzLimDwnUp = EgtIf( vtRef:getZ() < -0.017, -2, nil)
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
@@ -173,7 +181,7 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
local dExtraCut = EgtIf( i % 2 == 1, 0, BD.CUT_EXTRA)
-- lavoro la faccia
for j = 1, #vCuts[i] do
bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, nil, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
end
@@ -181,14 +189,14 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli
if vFaceOrd[1] ~= 0 then
-- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef)
bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
-- lavoro la faccia opposta (definita dal parametro P11)
if vFaceOrd[3] ~= 0 then
-- inserisco la lavorazione
local vtOrthoO = Vector3d( vtRef)
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
if not bOk then return bOk, sErr end
end
end
@@ -198,7 +206,9 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -287,8 +297,12 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg)
local bDownHead = ( BD.DOWN_HEAD and vtRef:getZ() < -0.01)
local bTopHead = ( BD.DOWN_HEAD and ( vtRef:getZ() > -0.01 or not bDownHead))
-- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide')
local sCutting = ML.FindCutting( 'HeadSide', bTopHead, bDownHead)
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
@@ -401,7 +415,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[5]], - X_AX()) and abs( ptC[vFaceOrd[5]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[5]], - X_AX()) and abs( ptC[vFaceOrd[5]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -438,9 +452,9 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la lavorazione. considerando l dimensione del lato e l'affondamento
local sPocketing
if dDistFaces then
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, dDistFaces)
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, dDistFaces, nil, bTopHead, bDownHead)
else
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax)
sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, nil, nil, bTopHead, bDownHead)
end
if not sPocketing then
@@ -473,7 +487,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dDistFaces, 1) .. ';')
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+16 -14
View File
@@ -1,5 +1,6 @@
-- ProcessSimpleScarf.lua by Egaltech s.r.l. 2020/06/04
-- Gestione calcolo giunto Gerber per Travi
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessSimpleScarf = {}
@@ -91,7 +92,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -114,7 +115,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -124,7 +125,9 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -208,7 +211,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -218,25 +221,24 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOk then return bOk, sNameOrErr end
end
end
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
+179 -10
View File
@@ -1,5 +1,7 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25
-- ProcessSplit.lua by Egaltech s.r.l. 2022/06/07
-- 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.
-- Tabella per definizione modulo
local ProcessSplit = {}
@@ -8,6 +10,8 @@ local ProcessSplit = {}
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
EgtOutLog( ' ProcessSplit started', 1)
@@ -109,7 +113,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -132,7 +136,7 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -140,9 +144,97 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
return true, nil
end
---------------------------------------------------------------------
-- lavorazione con sega a catena per sezioni alte e larghe
local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
-- Recupero i dati dell'utensile
local sSawing = ML.FindSawing('Sawing')
local dMaxMat = 0
local dSawCornerRad = 0
local dSawThick = 0
-- se non trova una lavorazione di sawing esco
if not sSawing then
local sErr = 'Error : Sawing not found in library'
EgtOutLog( sErr)
return false, sErr, 'MNF'
else
-- recupero i dati dell'utensile
if EgtMdbSetCurrMachining( sSawing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dSawCornerRad = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or dSawCornerRad
end
end
end
-- inserisco la lavorazione di sawing
local sName = 'Csaw_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_1'
local nMchFId = EgtAddMachining( sName, sSawing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing
EgtOutLog( sErr)
return false, sErr
end
sName = EgtGetOperationName( nMchFId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nSurfId, 0}})
-- imposto uso del lato faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT)
vtOrthO = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
-- 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( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
if EgtIsMachiningEmpty() then
_, sWarn = EgtGetMachMgrWarning( 0)
EgtSetOperationMode( nMchFId, false)
return false, sWarn
end
--end
return true, sName, nMchFId
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail)
if not BD.OVM_CHAIN_HBEAM then
BD.OVM_CHAIN_HBEAM = 8
end
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- inserimento smussi
@@ -170,10 +262,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- caratteristiche taglio
local bHorizCut = ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM)
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( b3Raw:getDimZ() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 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
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- flag di lavorazione faccia
@@ -195,8 +288,84 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
b3Raw:Add( b3NextRaw)
end
end
-- se taglio per pezzi alti e larghi
local nNewPhase = 0
if bBigSectionCut then
local bFinishingNeeded = false
if bSplit then
--taglio sega a catena
local cutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
local sNotesSplit = 'Presplit;'
local dOffs = 0
if dOvmTail > BD.OVM_CHAIN_HBEAM then
dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM
bFinishingNeeded = true
end
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
-- creo nuova fase per successiva finitura
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
-- fine creazione nuova fase
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
if not bDoubleHorizCut then
elseif not bDoubleHorizCut then
-- calcolo extra taglio ed accorciamento
local dCutExtra = 0
local dAccStart = 0
@@ -237,7 +406,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
else
-- recupero la lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2')
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr)
@@ -285,7 +454,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
if not bOk then return false, sErr end
end
end
return true
return true, nil, nNewPhase
end
---------------------------------------------------------------------
+14 -26
View File
@@ -83,11 +83,8 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la lavorazione
local sMillType = 'Mark'
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', ''))
if not sMilling and bDownHead then
sMilling = ML.FindMilling( sMillType)
bDownHead = false
end
local sMilling
sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
@@ -109,7 +106,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -132,7 +129,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -191,15 +188,15 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- se convesso, lo tratto come due tagli singoli
if bConvex then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- lavoro per prima la faccia più diretta in alto
local vOrd = { 1, 2}
if vtN[2]:getZ() > vtN[1]:getZ() then
@@ -247,20 +244,12 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
@@ -383,7 +372,6 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- Taglio la faccia 2
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
@@ -391,6 +379,7 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr)
return false, sErr
end
-- Taglio la faccia 2
-- creo piano di taglio coincidente con la faccia 2 e lo lavoro
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptC[3], vtN[3], b3Solid, GDB_RT.GLOB)
if AddId then
@@ -409,13 +398,12 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
+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)
-- recupero la lavorazione
local sCutType = 'HeadSide'
local sCutting = ML.FindCutting( sCutType .. EgtIf( bDownHead, '_H2', ''))
if not sCutting and bTopHead then
sCutting = ML.FindCutting( sCutType)
bDownHead = false
end
local sCutting
sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead)
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
@@ -84,21 +81,20 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid,
if dAng < -90.5 and dAng > -179.5 then
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
end
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- verifico se necessari tagli supplementari
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
--DC.PrintOrderCut( vCuts)
if #vCuts > 0 then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
@@ -162,11 +158,7 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
local bTopHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() > -0.1)
local bDownHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() < 0.1)
-- recupero la lavorazione
local sPocketing = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic)
if not sPocketing and bTopHead then
sPocketing = ML.FindPocketing( sMchFind, dDiamTool, dElev + dCollSic)
bDownHead = false
end
local sPocketing, _, _, bDownHead = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic, nil, bTopHead, bDownHead)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
@@ -202,10 +194,10 @@ local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchF
-- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -271,10 +263,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
-- scelta lavorazione
local sMilling
local sTypeMill = EgtIf( nUseRoughTool > 0, 'Long2Cut', 'LongSmallCut')
sMilling = ML.FindMilling( sTypeMill .. EgtIf( bDownHead, '_H2', ''), nil, sTuuidMstr)
if not sMilling and bTopHead then
sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr)
end
sMilling = ML.FindMilling( sTypeMill, nil, sTuuidMstr, nil, nil, bTopHead, bDownHead)
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
@@ -319,7 +308,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN,
EgtSetMachiningParam( MCH_MP.LIPERP, 20)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.AS_LI)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
@@ -534,11 +523,8 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- recupero la lavorazione
local sMillType = 'Mark'
local bDownHead = ( BD.DOWN_HEAD and abs( vtExtr:getZ()) < 0.1)
local sMilling = ML.FindMilling( sMillType .. EgtIf( bDownHead, '_H2', ''))
if not sMilling and bDownHead then
sMilling = ML.FindMilling( sMillType)
bDownHead = false
end
local sMilling
sMilling, _, _, bDownHead = ML.FindMilling( sMillType, nil, nil, nil, nil, true, bDownHead)
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
@@ -561,7 +547,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -586,7 +572,7 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
+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
-- 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
local ProcessTenon = {}
@@ -8,6 +11,7 @@ local ProcessTenon = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
local Fbp = require( 'FaceByPocket')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessTenon started', 1)
@@ -19,6 +23,10 @@ local ML = require( 'MachiningLib')
---------------------------------------------------------------------
local function VerifyOrientation( Proc, vtN, b3Raw)
-- se PF con testa da sotto, ammessa qualunque orientazione
if BD.C_SIMM and BD.DOWN_HEAD then
return true
end
-- se trave molto bassa
if b3Raw:getDimZ() <= 120 then
-- se tenone praticamente in asse, accetto fino a -45 deg
@@ -73,41 +81,6 @@ function ProcessTenon.Classify( Proc, b3Raw)
return true, bDown
end
---------------------------------------------------------------------
local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr)
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nStep
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nIdSurf, -1}})
-- imposto uso faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
if dSurfStep > 0 then
-- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dSurfStep, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
@@ -155,8 +128,6 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
-- porto inizio curva il più possibile sul bordo
BL.PutStartNearestToEdge( AuxId, b3Solid, bMillDown and not bShortPart)
-- se vero tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
if Proc.Prc ~= 52 and
( not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
@@ -176,43 +147,16 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura
if bShortPart and vtExtr:getX() < 0 and vtExtr:getZ() < -0.09 and BD.DOWN_HEAD then
-- recupero la lavorazione
local sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket')
local sPocketing = ML.FindPocketing( sPockType)
local dMaxDepth = 100
local dStep = 30
local nSurfStep
-- acquisisco i dati necessari dall'utensile
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- acquisisco elevazione
local dElev = BL.GetFaceElevation( AddId, 0, nPartId)
nSurfStep = ceil( dElev / dMaxDepth)
dSurfStep = dElev / nSurfStep
local bOk = true
local sErr
-- copio superfice al passo superfice e ci applico la lavorazione
for i = nSurfStep, 2, -1 do
local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptC+((dSurfStep*(i-1))*vtN), vtN, b3Solid, GDB_RT.GLOB)
if nAddIdTmp then
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
-- aggiungo lavorazione
bOk, sErr = ApplyPocket( Proc, sPocketing, i, (dSurfStep + 0), nAddIdTmp, vtExtr)
if not bOk then
break
end
end
end
if not bOk then
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, not bMillDown, bMillDown)
if not sPocketing then
local sErr = 'Error : pocketing '..sPockType..' not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- faccio ultima superfice
bOk, sErr = ApplyPocket( Proc, sPocketing, 1, EgtIf( nSurfStep > 1, ( dSurfStep + 0), 0), AddId, vtExtr)
-- eseguo le svuotature necessarie
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
if not bOk then
return false, sErr
end
@@ -223,16 +167,17 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
local bFromBottom = ( bShortPart and vtExtr:getZ() > 0.25)
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom)
if not bOk then return bOk, sErr end
if not bOk then
return false, sErr
end
end
end
end
-- recupero la lavorazione
local sMillType = 'Tenon'
local sCurrType = sMillType .. EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sCurrType, dTenH) or ML.FindMilling( sCurrType)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType, dTenH) or ML.FindMilling( sMillType)
local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
end
if not sMilling then
local sErr = 'Error : milling not found in library'
@@ -252,6 +197,13 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
bCW = ( dSpeed >= 0)
end
end
-- massimo numero di passate e coefficiente di sovrapposizione ta passate
local MAX_PASS = 6
local OVERLAP_COEFF = 0.7
-- porto inizio curva il più possibile sul bordo in alto o in basso
local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS
local bMyShortPart = ( bShortPart and 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
local sWarn
local dDepth = 0
@@ -262,9 +214,8 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
end
-- determino il numero di passate concentriche (max 6)
local MAX_PASS = 6
local nPass = min( ceil( dPockL / ( 0.7 * dMillDiam)), MAX_PASS)
local dStep = min( dPockL, 0.7 * dMillDiam * MAX_PASS) / nPass
local nPass = min( ceil( dPockL / ( OVERLAP_COEFF * dMillDiam)), MAX_PASS)
local dStep = min( dPockL, OVERLAP_COEFF * dMillDiam * MAX_PASS) / nPass
for i = nPass, 1, -1 do
-- inserisco la passata finale della lavorazione
local sNameF = 'TenF_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -293,7 +244,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if not BD.C_SIMM and not BD.TURN then
nSCC = MCH_SCC.ADIR_YM
if abs( vtExtr:getY()) > 0.088 then
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
@@ -301,7 +252,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+3 -6
View File
@@ -56,11 +56,8 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174)
-- recupero la lavorazione
local sMillType = 'Text'
local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType..sMchExt)
if not sMilling and bMillUp then
sMilling = ML.FindMilling( sMillType)
end
--local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr)
@@ -83,7 +80,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
+20 -13
View File
@@ -1,5 +1,6 @@
-- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2020/10/14
-- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2022/03/21
-- Gestione calcolo giunzione tirolese
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- Tabella per definizione modulo
local ProcessTyroleanDovetail = {}
@@ -116,7 +117,12 @@ function ProcessTyroleanDovetail.Classify( Proc, b3Raw)
-- considerazioni: al momento non è possibile sapere se ci sono due rastremature o una quindi se è rivolta verso il basso
-- viene dato errore, altrimenti si potrebbe imporre la rotazione di 180 (ovviamente con una sola rastrematura rivolta verso il basso)
if abs(vtN:getZ()) > abs(vtN:getX()) and abs(vtN:getZ()) > abs(vtN:getY()) and vtN:getZ() < -0.5 then
return false
-- se con due facce e corto è fattibile
if nFacetCnt < 3 and Proc.Box:getDimX() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ()) then
return true
else
return false
end
end
end
end
@@ -136,7 +142,7 @@ local function EvaluateQParam( Proc, sDephtCham)
end
---------------------------------------------------------------------
local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt, dOvmTail)
-- dati delle facce
local ptC = {}
@@ -203,7 +209,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -219,7 +225,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -251,15 +257,14 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
local vCuts = {}
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
elseif vFaceOrd[3] ~= 0 then
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
end
if #vCuts > 0 then
-- sistemo posizione nel DB e nome
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
end
@@ -318,7 +323,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
bCut = false
end
-- se di coda e coincide con taglio di separazione, non va fatto
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
bCut = false
end
-- se va fatto, inserisco la lavorazione
@@ -452,7 +457,7 @@ local function MakeMillCut( Proc, i, j, k, sMilling, nFacInd, TabNAD, rfFac, dOf
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
@@ -472,7 +477,7 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
local sErr = 'Error : missing AddGroup'
EgtOutLog( sErr)
return false, sErr
end
@@ -667,7 +672,9 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
-- in base al tipo di feature attribuisco il significato dei parametri Q
@@ -689,7 +696,7 @@ function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- se ho due facce allora è di testa
if nFacetCnt == 2 then
local bOk, sErr = MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
local bOk, sErr = MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt, dOvmTail)
if not bOk then return bOk, sErr end
else
local bOk, sErr = MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
+140 -30
View File
@@ -114,9 +114,24 @@ local function NewMachGroupName()
return nMaxMachGroup + 1
end
local function TotRawCount(Raws)
local nTotRaws = 0
for RawIndex = 1, #Raws do
nTotRaws = nTotRaws + Raws[RawIndex].Count
end
return nTotRaws
end
local function TotPartLen(Parts)
local nTotPartLen = 0
for PartIndex = 1, #Parts do
nTotPartLen = nTotPartLen + ( Parts[PartIndex].Len * Parts[PartIndex].Cnt)
end
return nTotPartLen
end
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( NEST.BASEDIR .. '\\LuaLibs\\?.lua')
-- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi
EgtSetCurrMachine( NEST.MACHINE)
@@ -133,21 +148,22 @@ end
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua')
---- Carico le librerie
--_G.package.loaded.WallExec = nil
--local WE = require( 'BeamExec')
--_G.package.loaded.WallLib = nil
--local WL = require( 'BeamLib')
--_G.package.loaded.WProcessLapJoint = nil
--local LapJoint = require( 'WProcessLapJoint')
-- Inizializzo contatori errori e avvisi
local nErrCnt = 0
local nWarnCnt = 0
-- Grezzi
local Raws = { LenToFill = LEN["1"], StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1, Count = QTY["1"]}
local nTotRaws = Raws.Count
-- lista dei grezzi
local Raws = {}
-- creo tabella dei grezzi
for nIndex, nLen in pairs( LEN) do
table.insert(Raws, {LenToFill = nLen, StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1})
end
for nIndex, nQty in pairs( QTY) do
Raws[tonumber(nIndex)].Count = nQty
end
--local nTotRaws = Raws.Count
-- Pezzi
local Parts = {}
@@ -156,50 +172,143 @@ local Parts = {}
for nPartId, nCount in pairs( PART) do
-- recupero lunghezza pezzo
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})
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
local nRawTot = 0
local dTime = 0
while Raws.Count > 0 and PartsToFill( Parts) > 0 do
-- Eseguo ottimizzazione per una barra e visualizzo il risultato
local Res = ExecMaximumFilling( Raws, Parts)
local nCycle = 1
while TotRawCount( Raws) > 0 and PartsToFill( Parts) > 0 do
-- creo lista pezzi con pezzi lunghi e pezzi corti di questo Cycle
local PartsToNest = {}
for PartIndex = 1, #LongList do
table.insert( PartsToNest, LongList[PartIndex])
end
for CycleIndex = 1, #RawsShortList do
if CycleIndex <= nCycle then
for PartIndex = 1, #RawsShortList[CycleIndex] do
table.insert( PartsToNest, RawsShortList[CycleIndex][PartIndex])
end
end
end
-- se non ci sono pezzi da nestare, esco
if PartsToFill( PartsToNest) <= 0 then
break
end
-- Eseguo ottimizzazione per ogni lunghezza di barra
local Results = {}
for RawIndex = 1, #Raws do
if Raws[RawIndex].Count > 0 then
Results[RawIndex] = ExecMaximumFilling( Raws[RawIndex], PartsToNest)
else
Results[RawIndex] = { FillRatio = 0.001, LenToFill = 1000}
end
end
-- verifico quale e' quella con meno scarto
local nMinWasteRawIndex = GDB_ID.NULL
local dMinWaste = 100000
for ResultIndex = 1, #Results do
if Results[ResultIndex] then
local dWaste = (1 - Results[ResultIndex].FillRatio) * Raws[ResultIndex].LenToFill
if dWaste < dMinWaste then
dMinWaste = dWaste
nMinWasteRawIndex = ResultIndex
end
end
end
-- verifico se ci sono pezzi
if Res.DiffParts > 0 then
if nMinWasteRawIndex > 0 and Results[nMinWasteRawIndex] and Results[nMinWasteRawIndex].DiffParts > 0 then
-- creo gruppo di lavorazione
local MachGroupName = NewMachGroupName()
nMachGroup = EgtAddMachGroup( MachGroupName)
EgtSetInfo( nMachGroup, "BARLEN", Raws.LenToFill)
EgtSetInfo( nMachGroup, "BARLEN", Raws[nMinWasteRawIndex].LenToFill)
EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL)
EgtSetInfo( nMachGroup, "AUTONEST", 1)
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
EgtSetInfo( nMachGroup, "PATTID", nMachGroup)
-- Disegno i pezzi
local CurrX = Raws.StartGap
local CurrX = Raws[nMinWasteRawIndex].StartGap
local nInfoIndex = 1
for i = 1, Res.DiffParts do
local PartIndex = Res.Data[i].Id
local PartId = Parts[PartIndex].Id
local dLen = Parts[PartIndex].Len
for j = 1, Res.Data[i].Count do
for i = 1, Results[nMinWasteRawIndex].DiffParts do
local PartIndex = Results[nMinWasteRawIndex].Data[i].Id
local PartId = PartsToNest[PartIndex].Id
local dLen = PartsToNest[PartIndex].Len
for j = 1, Results[nMinWasteRawIndex].Data[i].Count do
-- creo pezzo copia
local nPartDuploId = EgtDuploNew( PartId)
EgtSetInfo( nMachGroup, "PART" .. nInfoIndex, nPartDuploId .. "," .. CurrX)
CurrX = CurrX + dLen + Raws.MidGap
CurrX = CurrX + dLen + Raws[nMinWasteRawIndex].MidGap
nInfoIndex = nInfoIndex + 1
end
end
nRawTot = nRawTot + 1
end
-- Aggiorno per prossima iterazione
Raws.Count = Raws.Count - 1
for i = 1, Res.DiffParts do
local PartId = Res.Data[i].Id
Parts[PartId].Cnt = Parts[PartId].Cnt - Res.Data[i].Count
Raws[nMinWasteRawIndex].Count = Raws[nMinWasteRawIndex].Count - 1
for i = 1, Results[nMinWasteRawIndex].DiffParts do
local PartId = Results[nMinWasteRawIndex].Data[i].Id
PartsToNest[PartId].Cnt = PartsToNest[PartId].Cnt - Results[nMinWasteRawIndex].Data[i].Count
end
end
nCycle = nCycle + 1
end
-- creo grezzi per ogni gruppo di lavorazione
@@ -208,6 +317,7 @@ _G.BEAM = {}
BEAM.FILE = NEST.FILE
BEAM.MACHINE = NEST.MACHINE
BEAM.FLAG = 6 -- CREATE_PANEL
BEAM.BASEDIR = NEST.BASEDIR
nMachGroup = EgtGetFirstMachGroup()
while nMachGroup do
local nNextMachGroup = EgtGetNextMachGroup( nMachGroup)
+1 -2
View File
@@ -11,8 +11,7 @@ _ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
local sMachDir = EgtGetCurrMachineDir()