Compare commits

...

176 Commits

Author SHA1 Message Date
luca.mazzoleni dbf0d3cf01 update commenti 2024-01-18 16:17:16 +01:00
luca.mazzoleni e5bab7f1ab - piccola correzione a split 2024-01-18 12:37:40 +01:00
luca.mazzoleni b8fb6816a6 correzione minore 2024-01-16 18:21:06 +01:00
luca.mazzoleni ffb7580a65 - implementata funzione GetBlockedAxis, in BeamLib, che sostituisce le altre specifiche per sega a catena e lama; modificate le relative chiamate 2024-01-16 15:51:59 +01:00
luca.mazzoleni 6255b4c1cb Merge branch 'develop' into Feature/BigSectionForWideBeams 2024-01-12 14:41:42 +01:00
luca.mazzoleni 3ae3bcf1d3 Merge remote-tracking branch 'origin/master' into develop 2024-01-12 14:41:28 +01:00
Dario Sassi a01733defd DataBeam :
- piccola correzione per tagli lama con doppia inclinazione su macchina OikosX.
2024-01-12 12:51:36 +01:00
luca.mazzoleni ba9df21ab1 Merge branch 'develop' into Feature/BigSectionForWideBeams 2024-01-11 16:30:51 +01:00
luca.mazzoleni 6a58e94af0 Merge remote-tracking branch 'origin/master' into develop 2024-01-11 16:30:40 +01:00
luca.mazzoleni eb93769055 - in Split gestiti i tagli aggiuntivi verticali in tutti i casi 2024-01-11 16:22:39 +01:00
luca.mazzoleni 0acffe8d52 - in HeadCut gestiti i tagli aggiuntivi verticali in tutti i casi
- in Cut gestito il passaggio di superficie limitante alla GetDice
- in Split manca la gestione dei tagli aggiuntivi verticali in caso di BigSection
2024-01-11 12:25:28 +01:00
Dario Sassi f2c28f3810 DataBeam :
- correzione a posizionamento barre centrate su tavola da nuova interfaccia.
2024-01-10 23:34:46 +01:00
luca.mazzoleni 0a830c7f4b correzioni alle chiamate a GetSawBlockedAxis per Oikos 2024-01-09 11:43:07 +01:00
luca.mazzoleni 0778516765 Merge branch 'develop' into Feature/BigSectionForWideBeams 2024-01-09 10:07:38 +01:00
luca.mazzoleni 334d8d369e Merge remote-tracking branch 'origin/master' into develop 2024-01-09 09:51:12 +01:00
Dario Sassi 4a6b3accb1 DataBeam :
- alcune modifiche per macchine OikosX e similari.
2024-01-08 19:10:57 +01:00
luca.mazzoleni e22db4a989 Merge branch 'develop' into Feature/BigSectionForWideBeams 2024-01-08 18:09:53 +01:00
luca.mazzoleni 6021a50136 Merge tag '2.5l3' into develop
Finish Release: 2.5l3
2024-01-08 18:07:45 +01:00
luca.mazzoleni 748a6e295a Merge branch 'release/2.5l3' 2024-01-08 18:07:44 +01:00
luca.mazzoleni 2bd563293c update log e version 2024-01-08 18:07:03 +01:00
luca.mazzoleni cc099fb54c - Correzione a Is3EdgesApprox per casi in cui nAddGroup non esista ancora. 2024-01-08 17:19:41 +01:00
luca.mazzoleni 22c74c3252 - in headcut e split varie correzioni a tagli aggiuntivi per trave larga; rimangono da implementare per BigSection
- test annotations @param, #return in funzione GetFaceHvRefDim del BeamLib
2024-01-08 16:55:31 +01:00
luca.mazzoleni 3acebbd892 in split -> bigSection piccola correzione al sormonto tra sega a catena e lama 2024-01-04 18:33:07 +01:00
luca.mazzoleni bc04b680d4 - aggiunta GetSawBlockedAxis per scegliere asse bloccato aggregato lama 2024-01-04 17:29:42 +01:00
luca.mazzoleni 6e8cd5f3bb Merge branch 'develop' into Feature/BigSectionForWideBeams 2024-01-04 11:45:17 +01:00
luca.mazzoleni 91aa9d049f Merge remote-tracking branch 'origin/HEAD' into develop 2024-01-04 11:44:59 +01:00
luca.mazzoleni 5f7f988552 - in split -> bigSection primo implemento sega a catena da sopra e lama da sotto
- in split -> bigSection scelta sega a catena in base a lunghezza
2024-01-04 11:44:44 +01:00
Dario Sassi 7d65813c32 DataBeam 2.5l4 :
- modifiche per centrare i pezzi in Y sulla tavola (da flag BeamData.CENTER_BEAM)
- modifiche per rendere più veloci i calcoli di FeatureTopology
- scorporata CalcHeadTailMachBeforeIntersDrillings da CollectFeatures
- migliorato calcolo attacco/uscite lame in FacesBySaw.
2024-01-02 16:07:40 +01:00
luca.mazzoleni 42d68d968d Merge branch 'develop' into Feature/BigSectionForWideBeams 2023-12-21 11:39:20 +01:00
luca.mazzoleni 01f0182ef5 Merge tag '2.5l2' into develop
Finish Release: 2.5l2
2023-12-20 17:42:28 +01:00
luca.mazzoleni e0f27b9abe Merge branch 'release/2.5l2' 2023-12-20 17:42:28 +01:00
luca.mazzoleni c8b29241ca update log 2023-12-20 17:41:39 +01:00
luca.mazzoleni b0dea42f31 primi test 2023-12-20 17:17:28 +01:00
luca.mazzoleni a9462e189c Merge branch 'master' into develop 2023-12-15 17:57:26 +01:00
Dario Sassi 27ee10d1ec DataBeam :
- piccola miglioria alla precedente correzione, rimanevano non cancellate delle regioni di uso temporaneo.
2023-12-15 17:29:01 +01:00
luca.mazzoleni d73f535a55 Merge remote-tracking branch 'origin/master' into develop 2023-12-15 10:04:02 +01:00
Dario Sassi 5ae487cb20 DataBeam 2.5l2 :
- correzione a GetFaceWithMostAdj per calcoli con facce che fanno ombra.
2023-12-15 09:53:48 +01:00
luca.mazzoleni a3dcabf860 Merge remote-tracking branch 'origin/master' into develop 2023-12-11 09:04:41 +01:00
Dario Sassi 7b854c87c0 DataBeam :
- altra correzione a RoundArch per senso rotazione fresa e modalità climb.
2023-12-08 16:14:06 +01:00
luca.mazzoleni d2fc60b7f1 Merge branch 'master' into develop 2023-12-07 12:53:32 +01:00
Dario Sassi 286816e8e9 DataBeam :
- in ProcessRoundArch aggiunta gestione senso di rotazione della fresa per lavorare sempre in concordanza (climb milling).
2023-12-07 11:16:11 +01:00
luca.mazzoleni 01fbcbbd01 Merge branch 'CutAvoidCollisionsWhenDownUp' into develop 2023-12-07 09:56:49 +01:00
luca.mazzoleni d1c014e20c In ProcessCut e DoubleCut correzione in scelta ribaltamento trave quando si è in condizioni downUp. 2023-12-07 09:55:19 +01:00
luca.mazzoleni 92a924dde1 Merge branch 'develop' into CutAvoidCollisionsWhenDownUp 2023-12-06 18:38:56 +01:00
luca.mazzoleni d033fee929 Merge branch 'SideMillAsSawImprovement' into develop 2023-12-06 18:12:21 +01:00
luca.mazzoleni 1070910b8c - In ProcessLapJoint -> VerifySideMillAsSaw, se SIDEDEPTH non definita, viene calcolata
- update commenti
2023-12-06 17:50:26 +01:00
luca.mazzoleni 306b5b6dff in ProcessCut -> Classify si forza la rotazione della trave se inclinata in Y e la lama non riesce a lavorare solo da un lato, come per doublecut 2023-12-06 15:12:08 +01:00
luca.mazzoleni d2a6d7e75c in ProcessDoubleCut -> Classify si forza la rotazione della trave se inclinata in Y e la lama non riesce a lavorare solo da un lato 2023-12-06 10:44:21 +01:00
luca.mazzoleni 6309092689 In FacesBySaw -> CalcLeadInOutPerpGeom gestito caso in cui la geometria della feature esce dal grezzo 2023-12-05 18:37:28 +01:00
luca.mazzoleni 2ec0d8162e in LapJoint->MakeMoreFaces, nelle OpenPocket, ammesso utensile con diametro fino a 3 volte la dimensione della tasca (era 2) 2023-12-01 10:40:15 +01:00
luca.mazzoleni 60919c595d Merge tag '2.5l1' into develop
Finish Release: 2.5l1
2023-12-01 09:33:29 +01:00
luca.mazzoleni 0638e3c6f3 Merge branch 'release/2.5l1' 2023-12-01 09:33:28 +01:00
luca.mazzoleni de80902a86 update log e versione 2023-12-01 09:33:10 +01:00
luca.mazzoleni 9fbd4a5156 - in MakeTwo di FacesBySaw raffinamento calcolo vtRef per casi dubbi. 2023-11-30 09:23:12 +01:00
luca.mazzoleni 6bd2e5ffb4 - nelle chiamate a EgtSurfTmFacetElevationInBBox aggiunto parametro per forzare calcolo anche se la faccia è esterna al grezzo
- update commenti
2023-11-30 09:12:49 +01:00
luca.mazzoleni f89129d2e8 Merge branch 'ElevationCalculationRefactoring' into develop 2023-11-29 16:50:17 +01:00
luca.mazzoleni e0e2f630d2 Merge remote-tracking branch 'origin/master' into develop 2023-11-29 16:07:49 +01:00
luca.mazzoleni 1664513c8f Ottimizzate le chiamate al calcolo elevazione. Si evita di calcolarla più volte inutilmente perchè calcolata inizialmente nel CollectFeatures. 2023-11-29 16:07:18 +01:00
Dario Sassi c701d4132f DataBeam :
- in MakeTwo di FacesBySaw raffinamento calcolo vtRef per casi dubbi.
2023-11-28 15:56:10 +01:00
Dario Sassi a9052c1d72 Merge commit 'b3bb386ec776ad753e1d9042d90ecd9834c2abd2' 2023-11-28 15:54:49 +01:00
luca.mazzoleni 593fdcfc24 Merge branch 'develop' into ElevationCalculationRefactoring 2023-11-28 15:44:43 +01:00
luca.mazzoleni b9c8921cb2 Merge tag '2.5k5' into develop
Finish Release: 2.5k5
2023-11-28 15:40:00 +01:00
luca.mazzoleni b3bb386ec7 Merge branch 'release/2.5k5' 2023-11-28 15:40:00 +01:00
luca.mazzoleni c69f80a903 update log e versione 2023-11-28 15:39:33 +01:00
luca.mazzoleni d8de7467b0 - tutte le chiamate alle funzioni GetFaceElevation e GetOtherFaceElevation sostituiti con la nuova funzione EgtSurfTmFacetElevationInBBox 2023-11-28 09:55:41 +01:00
luca.mazzoleni 42c043fcd7 Merge branch 'Q05InLong2Cut' into develop 2023-11-24 15:24:03 +01:00
luca.mazzoleni 344467a500 - In Long2Cut, in implemento Q05 come LongCut, aggiunte puliture.
- In Dovetail correzione per variabile sMilling portata da globale a locale.
2023-11-24 15:23:52 +01:00
luca.mazzoleni e82a8c9c1f -In Long2Cut, in implemento Q05 come LongCut, gestiti allungamenti e accorciamenti. Mancano le puliture.
-In LongCut aggiunti alcuni commenti riguardo al Q05.
2023-11-23 13:06:13 +01:00
luca.mazzoleni 85585c0b80 In Long2Cut primo implemento Q05 come LongCut. Ancora da gestire allungamenti e accorciamenti. 2023-11-21 16:23:03 +01:00
luca.mazzoleni 24e853ff92 Merge branch 'master' into develop 2023-11-20 09:51:52 +01:00
Dario Sassi 0bcdf65656 DataBeam 2.5k4 :
- in ProcessLongDoubleCut ora si utilizza la nuova funzione Lua EgtSurfTmFacetElevationInBBox per il calcolo esatto dell'elevazione di una faccia nel solido del pezzo.
2023-11-16 19:05:34 +01:00
Dario Sassi 1e442c7a01 Merge remote-tracking branch 'origin/develop' 2023-11-16 18:08:45 +01:00
luca.mazzoleni 24e38cdad5 in lapjoint modifiche a MakeStaircaseStep 2023-11-15 12:26:08 +01:00
andrea.villa a239a096cd FacesBySaw : In MakeOne migliorato calcolo scelta soluzione lama ( per macchina TURN) 2023-11-14 12:22:25 +01:00
andrea.villa 737abe7d30 Merge branch 'master' into develop 2023-11-14 12:19:19 +01:00
luca.mazzoleni b7b701f9d2 Merge branch 'develop' 2023-11-09 16:01:15 +01:00
Dario Sassi 5974edf8b1 DataBeam :
- aggiornato per compilazione manuale di ProcessVariant.
2023-11-08 17:50:59 +01:00
Dario Sassi 7fcf169b6b DataBeam 2.5k3 :
- aggiunta gestione features Variant (per ora solo con lavorazioni di tipo Pocket).
2023-11-08 17:46:20 +01:00
Dario Sassi f30558db04 DataBeam :
- migliorie e correzioni alla ricerca di lavorazioni di foratura con AngularTransmission ("_AT")
- migliorata gestione dei fori e delle tasche con AngularTransmission.
2023-11-07 09:37:33 +01:00
luca.mazzoleni cb17b9737e Merge branch 'master' into develop 2023-11-06 18:16:07 +01:00
luca.mazzoleni 5315b63163 Merge branch 'develop' 2023-11-06 18:15:53 +01:00
luca.mazzoleni a87c9f5789 update versione e log 2023-11-06 18:15:41 +01:00
luca.mazzoleni 1dc4efa397 Merge branch 'release/2.5k2' 2023-11-06 18:10:39 +01:00
luca.mazzoleni 50917a61b2 Merge tag '2.5k2' into develop
Finish Release: 2.5k2
2023-11-06 18:10:39 +01:00
luca.mazzoleni a843ef2e25 In MakeStaircaseStep gestito ritorno 2023-11-06 18:09:16 +01:00
luca.mazzoleni fc3f6f22ac - update commenti 2023-11-03 18:38:05 +01:00
luca.mazzoleni 84bc8d7bd7 Merge branch 'Feature/L020SpecialStaircase' into develop 2023-11-03 18:33:33 +01:00
luca.mazzoleni 7c7fa26b8d - in Topology -> Classify ora si settano le AffectedFaces nella Proc, se non già presenti
- in LapJoint -> MakeStaircaseStep aggiunta lavorazione smussi opzionale
2023-11-03 18:32:54 +01:00
luca.mazzoleni 54fcc27c49 - in LapJoint -> MakeStaircaseStep aggiunta riduzione profondità lama in caso di angolo inferiore a 90deg 2023-11-03 09:42:12 +01:00
luca.mazzoleni a5a8a0e98b Merge branch 'develop' into Feature/L020SpecialStaircase 2023-11-02 18:27:15 +01:00
luca.mazzoleni 27df151d3d Merge remote-tracking branch 'origin/master' into develop 2023-11-02 18:26:06 +01:00
Dario Sassi 34b4867a0d DataBeam :
- in ProcessSplit si imposta l'ingombro asse C correttamente anche per teste con asse rotante C con un solo braccio.
2023-11-02 18:10:49 +01:00
Dario Sassi 2bf15f2958 Merge branch 'master' of https://gitlab.steamware.net/egaltech/DataBeam 2023-11-02 17:36:38 +01:00
Dario Sassi bfa26e7610 DataBeam 2.5k1 :
- correzione a ProcessSplit per scrittura sbagliata nome variabile (ora dTLen invece di dTlen).
2023-11-02 17:34:55 +01:00
luca.mazzoleni 398ea82d2b Merge branch 'master' into develop 2023-11-02 11:04:17 +01:00
luca.mazzoleni 6f8c94705b Merge branch 'develop' 2023-11-02 11:03:49 +01:00
luca.mazzoleni a77d0b2652 update log e versione 2023-11-02 11:01:52 +01:00
Dario Sassi 6c14b873f9 Merge remote-tracking branch 'origin/master' 2023-10-28 12:27:35 +02:00
luca.mazzoleni 15d85e174b Merge branch 'develop' into Feature/L020SpecialStaircase 2023-10-27 18:25:53 +02:00
luca.mazzoleni a2ba993709 Merge branch 'release/2.5j2' 2023-10-27 18:18:48 +02:00
luca.mazzoleni e90a4db38c Merge tag '2.5j2' into develop
Finish Release: 2.5j2
2023-10-27 18:18:48 +02:00
luca.mazzoleni 5820ccb455 update versione, log, commenti 2023-10-27 18:18:32 +02:00
luca.mazzoleni 57fa9bb8b3 - correzioni minori a LapJoint e Cut 2023-10-27 18:00:09 +02:00
luca.mazzoleni 3fe16f87b7 In LapJoint -> MakeStaircaseStep:
- invertite taglio di lama alzata e pedata
- step lama della pedata limitati a 2, uno a metà e uno in fondo
- corretto faceuse nel caso di lama da sotto (esclusi casi downup)
2023-10-27 17:01:07 +02:00
andrea.villa 15af95a77e Merge branch 'Feature/L020AngleBigger90Deg' into develop 2023-10-27 16:19:46 +02:00
andrea.villa a9e378c468 In LapJoint gestito caso groove due facce >90° con fresa, come da parametro Q 2023-10-27 16:19:23 +02:00
andrea.villa a524a60a41 In BeamLib aggiunto controllo per permettere tagli da sotto con testa da sopra su pezzi molto alti 2023-10-27 13:15:37 +02:00
luca.mazzoleni fdb897ec68 - In LapJoint -> MakeStaircaseStep aggiunti tagli di lama per pedata e alzata. Da verificare gli step 2023-10-27 09:56:09 +02:00
luca.mazzoleni 4e4a1eca4d - In LapJoint -> MakeStaircaseStep correzioni al calcolo step orizzontali fresa 2023-10-26 15:07:17 +02:00
andrea.villa 03bf116341 Merge branch 'Feature/LapJointAsLong2CutFix' into develop 2023-10-25 17:12:28 +02:00
andrea.villa 82d9d4dfde Commenti e migliorie messaggi warning 2023-10-25 16:55:10 +02:00
luca.mazzoleni d39148a9e8 Merge branch 'develop' into Feature/L020SpecialStaircase 2023-10-25 15:58:49 +02:00
luca.mazzoleni a7e0c5a33d - In LapJoint -> MakeStaircaseStep aggiunta la lavorazione con fresa 2023-10-25 15:56:53 +02:00
andrea.villa 8ddf1f260a In LapJoint e LongDoubleCut corretto comportamento con messaggi di ritorno in caso possa fare con lama 2023-10-25 15:37:52 +02:00
andrea.villa 8671415d5e In LapJoint e LongDoubleCut faccio di lama solo se taglio completamente. Altrimenti fresa. 2023-10-25 12:36:38 +02:00
andrea.villa e496feff2c - In LongDoubleCut limito lavorazione a massimo materiale lama prima di applicare. Da completare 2023-10-25 10:15:59 +02:00
andrea.villa 73431c52ca In MakeOne migliorata gestione taglio con percorso bilinea. 2023-10-24 14:45:26 +02:00
andrea.villa 5420bc5165 Merge branch 'Feature/BetterClampManagementOnCutLong' into develop 2023-10-24 14:36:30 +02:00
andrea.villa 3ccc382d5b Merge branch 'develop' into Feature/BetterClampManagementOnCutLong 2023-10-24 14:34:33 +02:00
andrea.villa 29af699ad5 - LongCut e LongDoubleCut: migliorata spezzatura taglio passante con due spezzoni
- BeamExec: aggiunta scrittura parametro BARLEN nelle info del mach group
2023-10-24 14:28:35 +02:00
luca.mazzoleni 5865192e23 Merge branch 'develop' into Feature/L020SpecialStaircase 2023-10-23 14:57:14 +02:00
luca.mazzoleni 374d99ffd9 Merge tag '2.5j1' into develop
Finish Release: 2.5j1
2023-10-23 12:52:53 +02:00
luca.mazzoleni a31c026430 Merge branch 'release/2.5j1' 2023-10-23 12:52:52 +02:00
luca.mazzoleni 982b07ad32 update log 2023-10-23 12:52:18 +02:00
luca.mazzoleni 869683c99a - a Topology aggiunta groove 2 facce (tipo birdsmouth passante)
- prima aggiunta di MakeStaircaseStep
2023-10-23 12:39:15 +02:00
luca.mazzoleni f147f77133 Merge remote-tracking branch 'origin/master' into develop 2023-10-19 09:13:07 +02:00
Dario Sassi 9c5b23d15d DataBeam 2.5j1 :
- nella ricerca lavorazione da usare controllo di utensile attivo sostituito con controllo utensile presente nel setup corrente
2023-10-18 15:09:01 +02:00
andrea.villa 62b1c186f7 Merge branch 'BugFix/HeadCutSplitFixForKairos' into develop 2023-10-17 14:53:52 +02:00
andrea.villa 55f4effbb6 - In HeadCut e Split corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative 2023-10-17 12:34:42 +02:00
Andrea Villa 70b9f9fe89 Merge remote-tracking branch 'origin/develop' into develop 2023-10-17 11:25:18 +02:00
luca.mazzoleni 2ff160f555 In FeatureTopology -> GetFacesParallelToPart rimossa Pocket e aggiunto Rabbet al check solo direzione principale 2023-10-16 18:35:26 +02:00
luca.mazzoleni 7ff3a8eba6 Merge remote-tracking branch 'origin/master' into develop 2023-10-16 09:42:26 +02:00
Dario Sassi 59934d0fdf DataBeam :
- in Process (lancio da EgtCAM5 quindi uso praticamente solo interno) aggiunta possibilità di tenere ordine pezzi in barra come da selezione.
2023-10-12 10:56:46 +02:00
luca.mazzoleni df99424632 Merge remote-tracking branch 'origin/master' into develop 2023-10-04 10:25:48 +02:00
luca.mazzoleni 61b1375c00 - in Lapjoint -> MakePocket aggiunto messaggio in caso si rovini il pezzo successivo 2023-10-04 10:25:38 +02:00
Dario Sassi 07c76f60c8 DataBeam :
- piccola correzione a Classify di FeatureTopology per casi senza geometria.
2023-10-04 09:28:20 +02:00
luca.mazzoleni 2c88c295c8 Merge tag '2.5i2' into develop
Finish Release: 2.5i2
2023-09-27 18:48:29 +02:00
luca.mazzoleni f0bd3d2e6f Merge branch 'release/2.5i2' 2023-09-27 18:48:29 +02:00
luca.mazzoleni a0d3bb9114 - update log 2023-09-27 18:48:13 +02:00
luca.mazzoleni 8f890f35e2 Merge branch 'develop' 2023-09-27 18:36:29 +02:00
luca.mazzoleni 30e2028ebf - in LapJoint -> MakeLongMoreFaces aggiunta Classify Topology alla AddProc creata 2023-09-27 18:35:35 +02:00
luca.mazzoleni 04454ac44f Merge branch 'Feature/BetterUndercutDetection' into develop 2023-09-27 17:43:17 +02:00
luca.mazzoleni d73dbfbffb Merge remote-tracking branch 'origin/HEAD' into develop 2023-09-27 17:36:06 +02:00
luca.mazzoleni b7ec0031e1 - piccola correzione a LapJoint 2023-09-27 17:35:56 +02:00
Dario Sassi d5f2422729 DataBeam 2.5i2 :
- aggiunta cancellazione curve temporanee da loop di facce in BeamLib.Is3EdgesApprox
- piccola modifica per Turn su bInvert di FacesBySaw.MakeOne
- in foratura quando errore in applicazione lavorazione si inverte e riprova solo se singola su foro aperto
- in MakeLongMoreFaces migliorata gestione spezzatura di Tunnel
- in lavorazione tenoni per Turn si assegna SCC per privilegiare accesso dal lato corto della trave.
2023-09-27 17:23:45 +02:00
luca.mazzoleni 1c25ca7667 - In LapJoint -> MakeMoreFaces e Classify refactoring della gestione scanalatura chiusa
- in FeatureTopology modificata GetFacesParallelToPart per tunnel, pocket e groove 3 lati
2023-09-27 11:54:33 +02:00
luca.mazzoleni f54cfa7eb3 - in BeamExec funzione IsFeatureCuttingEntireSection spostata in BeamLib; in ClassifyTopology aggiunto passaggio del parametro nRawId
- in BeamLib -> GetFaceWithMostAdj gestito primo parametro anche come Proc; gestito caso strip con facce tutte in sottosquadro; spostata qui funzione IsFeatureCuttingEntireSection da BeamExec
- In FeatureTopology aggiunte topologie Strip e Cut
- In ProcessDoveTail, ProcessLapJoint, ProcessLongCut, ProcessTyroleanDovetail modificata chiamata a GetFaceWithMostAdj
2023-09-26 17:39:16 +02:00
luca.mazzoleni 8cef86ffd5 - commenti e migliorie stilistiche 2023-09-25 11:38:58 +02:00
luca.mazzoleni 7402062859 - in BeamLib implementato metodo per rilevare sottosquadri da facce non adiacenti, da testare 2023-09-22 18:08:46 +02:00
luca.mazzoleni 36a663199c - in BeamLib implementato parzialmente metodo per rilevare sottosquadri da facce non adiacenti, da ultimare 2023-09-22 16:37:16 +02:00
luca.mazzoleni b628a4200d Merge branch 'BugFix/FixLapJointLongTunnel' into develop 2023-09-19 17:24:32 +02:00
luca.mazzoleni 0d3b3d1f04 Merge branch 'develop' into BugFix/FixLapJointLongTunnel 2023-09-19 17:22:27 +02:00
luca.mazzoleni c490d5d388 Merge branch 'master' into develop 2023-09-19 10:34:21 +02:00
luca.mazzoleni bc401eef07 update log 2023-09-19 10:27:53 +02:00
luca.mazzoleni a93326e3cd - in LapJoint -> MakeLongMoreFaces correzione allargamento superfici per caso di tunnel lungo 2023-09-19 10:08:42 +02:00
luca.mazzoleni 6b5d7525a1 - in LapJoint -> MakeLongMoreFaces modifiche finali per correzione caso tunnel lungo; da testare 2023-09-18 18:46:55 +02:00
luca.mazzoleni 111a733365 - in LapJoint -> MakeLongMoreFaces ulteriori modifiche parziali per correzione caso tunnel lungo 2023-09-18 17:01:22 +02:00
luca.mazzoleni 7ce6ca9f13 - in LapJoint -> MakeLongMoreFaces modifiche parziali per correzione caso tunnel lungo 2023-09-18 15:25:23 +02:00
luca.mazzoleni 6902620f5d - in BeamExec -> Collect aggiunto PartId anche in Proc2 2023-09-14 12:37:17 +02:00
luca.mazzoleni 7c6b5cf12c - in BeamExec -> CollectFeatures aggiunta la scrittura di PartId in Proc
- in LapJoint -> MakeMoreFaces se lavorazione con fresa di lato distinto caso 4 lati groove
2023-09-13 10:59:14 +02:00
luca.mazzoleni 9c0d2111f5 - aggiunta libreria FeatureTopology, clonata da Wall, per la classificazione topologica delle feature
- in BeamLib aggiunte funzioni Is3EdgesApprox e  GetProcessAffectedFaces, clonate da Wall
- in BeamExec aggiunta ClassifyTopology e la raccolta preliminare di alcune informazioni nel CollectFeatures
2023-09-13 09:19:58 +02:00
luca.mazzoleni 19d8be5c9e - in ProcessCut -> MakeFromTop abbassato a 590 mm il limite per convertire in LongCut
- aggiunto commento commit precedente
2023-09-12 10:24:34 +02:00
luca.mazzoleni 41a05b4199 Merge tag '2.5i1' into develop
Finish Release: 2.5i1
2023-09-12 09:05:24 +02:00
luca.mazzoleni ab48827689 Merge branch 'release/2.5i1' 2023-09-12 09:05:23 +02:00
luca.mazzoleni a859f170aa update log e versione 2023-09-12 09:05:05 +02:00
luca.mazzoleni 06f7fdb385 Merge branch 'master' into develop 2023-09-12 09:03:02 +02:00
luca.mazzoleni 36d0e0c198 Merge branch 'develop' 2023-09-12 09:02:34 +02:00
luca.mazzoleni e1dc521fe5 - in LapJoint gestito correttamente il ritorno nil di GetUShapeWidth 2023-09-12 09:01:17 +02:00
luca.mazzoleni 30fc2ab1a4 Merge tag '2.5h2' into develop
Finish Release: 2.5h2
2023-08-11 10:52:04 +02:00
luca.mazzoleni dacf2c5860 Merge branch 'release/2.5h2' 2023-08-11 10:52:03 +02:00
luca.mazzoleni abb7735f9d update log 2023-08-11 10:51:43 +02:00
luca.mazzoleni 2fb4338d50 Merge remote-tracking branch 'origin/master' into develop 2023-08-11 10:36:41 +02:00
Dario Sassi b0150f5b03 DataBeam 2.5h2 :
- in LapJoint e Mortise modificata posizione braccio per FAST quando vicino alla coda della trave
- in RidgeLap corretto ingombro lavorazione in testa e coda quando rivolta verso il basso.
2023-08-11 10:30:36 +02:00
luca.mazzoleni 5802f26bbf Merge branch 'master' into develop 2023-08-08 15:00:31 +02:00
luca.mazzoleni 3be500974a corrette forature con aggregato quando lato aperto 2023-08-08 14:52:03 +02:00
luca.mazzoleni 199c327151 Merge tag '2.5h1' into develop
Finish Release: 2.5h1
2023-08-07 18:31:32 +02:00
33 changed files with 2123 additions and 642 deletions
+8 -5
View File
@@ -1,4 +1,4 @@
-- BatchProcessNew.lua by Egaltech s.r.l. 2022/08/01
-- BatchProcessNew.lua by Egaltech s.r.l. 2024/01/10
-- 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).
@@ -12,6 +12,7 @@
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
-- 2022/07/24 Modifica per cancellare lavorazioni con ricalcolo e barra già definita.
-- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
-- 2024/01/10 Modifiche per centrare i pezzi in Y sulla tavola (come in BeamExec).
-- Intestazioni
require( 'EgtBase')
@@ -209,10 +210,7 @@ if bToProcess then
EgtSetCurrMachGroup()
-- Area tavola
local b3Tab = EgtGetTableArea()
-- Calcolo posizione estremo TR o BR della tavola rispetto a sua origine in BL
BD.OriXR = Point3d( b3Tab:getDimX(), EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()), 0)
BD.PosXR = EgtIf( BD.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
-- Calcolo minimo grezzo scaricabile
-- Sezione del grezzo
local nRawId = EgtGetFirstRawPart()
if not nRawId then
BEAM.ERR = 14
@@ -222,6 +220,11 @@ if bToProcess then
return
end
local b3Raw = EgtGetRawPartBBox( nRawId)
-- Calcolo posizione estremo TR o BR della tavola rispetto a sua origine in BL
local dPosY = EgtIf( BD.CENTER_BEAM, ( b3Tab:getDimY() + b3Raw:getDimY() * EgtIf( BD.RIGHT_LOAD, -1, 1)) / 2, EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()))
BD.OriXR = Point3d( b3Tab:getDimX(), dPosY, 0)
BD.PosXR = EgtIf( BD.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
-- Calcolo minimo grezzo scaricabile
BE.CalcMinUnloadableRaw( b3Raw:getDimY(), b3Raw:getDimZ())
-- altrimenti devo recuperare i pezzi per creare la barra
else
+3 -1
View File
@@ -1,5 +1,5 @@
REM Compilazione degli script Beam Egaltech 2023.02.27
REM Compilazione degli script Beam Egaltech 2023.11.08
REM Per togliere info di debug aggiungere flag -s prima del nome del file di input
REM Compilazione 32 e 64 bit
@@ -9,6 +9,7 @@ REM Compilazione 32 e 64 bit
\EgtProg\Dll32\luac54 -o bin\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\FeatureTopology.lua LuaLibs\FeatureTopology.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessChamfer.lua LuaLibs\ProcessChamfer.lua
@@ -43,6 +44,7 @@ REM Compilazione 32 e 64 bit
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTenon.lua LuaLibs\ProcessTenon.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessText.lua LuaLibs\ProcessText.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessVariant.lua LuaLibs\ProcessVariant.lua
\EgtProg\Dll32\luac54 -o bin\BatchProcess.lua BatchProcess.lua
\EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua BatchProcessNew.lua
\EgtProg\Dll32\luac54 -o bin\GetBeamData.lua GetBeamData.lua
+137 -33
View File
@@ -1,4 +1,4 @@
-- BeamExec.lua by Egaltech s.r.l. 2023/03/31
-- BeamExec.lua by Egaltech s.r.l. 2023/12/26
-- 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.
@@ -46,6 +46,13 @@
-- 2023/02/20 Ora le mortase a coda di rondine laterali sono sempre fatte prima dei tagli longitudinali.
-- 2023/03/31 Corretto ordinamento per fori di coda da lasciare in coda.
-- 2023/07/31 Corretto errore nelle mortase in doppio.
-- 2023/09/13 Aggiunta ClassifyTopology per la classificazione topologica delle feature. In CollectFeatures aggiunta la raccolta preliminare di alcune informazioni.
-- 2022/09/26 Funzione IsFeatureCuttingEntireSection spostata in BeamLib
-- 2022/09/26 In ClassifyTopology aggiunto passaggio del parametro nRawId
-- 2023/10/24 Aggiunta scrittura parametro BARLEN nelle info del mach group
-- 2023/11/08 Aggiunta gestione processi Variant.
-- 2023/11/30 Migliorato il calcolo elevazione con l'utilizzo della nuova funzione EgtSurfTmFacetElevationInBBox.
-- 2023/12/26 Modifiche per centrare i pezzi in Y sulla tavola.
-- Tabella per definizione modulo
local BeamExec = {}
@@ -100,8 +107,10 @@ _G.package.loaded.ProcessTyroleanDovetail = nil
_G.package.loaded.ProcessDovetail = nil
_G.package.loaded.ProcessFreeContour = nil
_G.package.loaded.ProcessDecor = nil
_G.package.loaded.ProcessVariant = nil
local ML = require( 'MachiningLib')
local BL = require( 'BeamLib')
local Topology = require( 'FeatureTopology')
local DC = require( 'DiceCut')
local Fbs = require( 'FacesBySaw')
local Hcut= require( 'ProcessHeadCut')
@@ -137,6 +146,7 @@ local TyroleanDovetail = require( 'ProcessTyroleanDovetail')
local Dovetail = require( 'ProcessDovetail')
local FreeContour = require( 'ProcessFreeContour')
local Decor = require( 'ProcessDecor')
local Variant = require( 'ProcessVariant')
EgtOutLog( ' BeamExec started', 1)
EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC)
@@ -248,9 +258,37 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
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))
local function NeedTopologyFeature( Proc)
-- richiedono calcolo topologia
if Cut.Identify( Proc) then
return true
end
if DoubleCut.Identify( Proc) then
return true
end
if LongCut.Identify( Proc) then
return true
end
if Long2Cut.Identify( Proc) then
return true
end
if SawCut.Identify( Proc) then
return true
end
if RidgeLap.Identify( Proc) then
return true
end
if LapJoint.Identify( Proc) then
return true
end
if FrenchRidgeLap.Identify( Proc) then
return true
end
if Chamfer.Identify( Proc) then
return true
end
-- tutte le altre non richiedono calcolo topologia
return false
end
-------------------------------------------------------------------------------------------------------------
@@ -262,8 +300,6 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
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
@@ -280,6 +316,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
local nAddMainId = EgtGetInfo( ProcId, 'MAINID', 'i')
if nGrp and nPrc and nDo == 1 then
local Proc = {}
Proc.PartId = PartId
Proc.Id = ProcId
Proc.Grp = nGrp
Proc.Prc = nPrc
@@ -297,20 +334,25 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
Proc.MainId = Proc.Id + nAddMainId
end
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
if b3Raw then
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- recupero l'elenco delle facce della parte interessate dalla feature
Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc)
-- recupero informazioni sulle facce della feature
if not Proc.Face then
Proc.Face = {}
for i = 1, Proc.Fct do
Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT )}
if Proc.Fct < 10 then
Proc.Face[i].Elevation = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, true, GDB_ID.ROOT)
end
end
end
end
if Proc.Box and not Proc.Box:isEmpty() then
Proc.NeedTopology = NeedTopologyFeature( Proc)
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
table.insert( vProc, Proc)
-- se foro
if Drill.Identify( Proc) then
@@ -324,6 +366,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
Proc.Tail = Drill.IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
-- definisco dati seconda parte
local Proc2 = {}
Proc2.PartId = PartId
Proc2.Id = ProcId
Proc2.Grp = nGrp
Proc2.Prc = nPrc
@@ -343,7 +386,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
end
-- se BlockHaus HalfLap
elseif Proc.Prc == 37 then
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId)
local nFacInd = BL.GetFaceWithMostAdj( Proc, PartId)
if nFacInd then
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN then
@@ -363,11 +406,38 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
ProcId = EgtGetNext( ProcId)
end
end
local vMachineBeforeIntersectingDrillings = {
Head = { Id = nMachineBeforeIntersectingDrillingsIdHead, Box = b3MachineBeforeIntersectingDrillingsBoxHead},
Tail = { Id = nMachineBeforeIntersectingDrillingsIdTail, Box = b3MachineBeforeIntersectingDrillingsBoxTail}
return vProc
end
-------------------------------------------------------------------------------------------------------------
local function CalcHeadTailMachBeforeIntersDrillings( vProc, b3Raw)
local nHeadId
local dHeadX = GEO.INFINITO
local nTailId
local dTailX = -GEO.INFINITO
local b3HeadBox
local b3TailBox
for i = 1, #vProc do
local Proc = vProc[i]
if Proc.Box and not Proc.Box:isEmpty() then
if Proc.Fct == 1 and BL.IsFeatureCuttingEntireSection( Proc.Box, b3Raw:getDimY(), b3Raw:getDimZ()) and ( Proc.Head or Proc.Tail) and Proc.Prc ~= 340 and Proc.Prc ~= 350 then
if Proc.Head and Proc.Box:getCenter():getX() < dHeadX then
dHeadX = Proc.Box:getCenter():getX()
nHeadId = Proc.Id
b3HeadBox = Proc.Box
elseif Proc.Tail and Proc.Box:getCenter():getX() > dTailX then
dTailX = Proc.Box:getCenter():getX()
nTailId = Proc.Id
b3TailBox = Proc.Box
end
end
end
end
local vMachBeforeIntersDrillings = {
Head = { Id = nHeadId, Box = b3HeadBox},
Tail = { Id = nTailId, Box = b3TailBox}
}
return vProc, vMachineBeforeIntersectingDrillings
return vMachBeforeIntersDrillings
end
-------------------------------------------------------------------------------------------------------------
@@ -387,7 +457,7 @@ local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
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)
bHeadFinishingNeeded = not BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
end
end
return bHeadFinishingNeeded, nReplacedFeatureId
@@ -410,7 +480,7 @@ local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
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)
bTailFinishingNeeded = not BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
end
end
return bTailFinishingNeeded, nReplacedFeatureId
@@ -469,10 +539,20 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
-- Impostazione della tavola
EgtSetTable( 'Tab')
-- salvo nota con lunghezza grezzo
-- Recupero l'identificativo del gruppo di lavoro corrente
local nMGrpId = EgtGetCurrMachGroup()
-- Lunghezza della barra
local dBarLen = EgtGetInfo( nMGrpId, 'BARLEN', 'd')
if not dBarLen then
EgtSetInfo( nMGrpId, 'BARLEN', dRawL)
end
-- Area tavola
local b3Tab = EgtGetTableArea()
-- Calcolo posizione estremo TR/BR della tavola rispetto a sua origine in BL
BD.OriXR = Point3d( b3Tab:getDimX(), EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()), 0)
local dPosY = EgtIf( BD.CENTER_BEAM, ( b3Tab:getDimY() + dRawW * EgtIf( BD.RIGHT_LOAD, -1, 1)) / 2, EgtIf( BD.RIGHT_LOAD, 0, b3Tab:getDimY()))
BD.OriXR = Point3d( b3Tab:getDimX(), dPosY, 0)
BD.PosXR = EgtIf( BD.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
-- Impostazione dell'attrezzaggio di default
@@ -651,11 +731,11 @@ local function PrintFeatures( vProc, b3Raw)
EgtOutLog( ' RawBox=' .. tostring( b3Raw))
for i = 1, #vProc do
local Proc = vProc[i]
local sOut = string.format( ' Id=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Down=%s Side=%s Head=%s Tail=%s Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s',
local sOut = string.format( ' Id=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Down=%s Side=%s Head=%s Tail=%s Fcse=%1d,%1d Diam=%.2f Fct=%2d Box=%s TopoName=%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', EgtIf( Proc.AdvTail, 'A', 'F')),
Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box))
Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, tostring( Proc.Box), Proc.TopologyLongName or '')
-- info speciali per Block Haus Half Lap
if Proc.Prc == 37 then
local sSpec = string.format( ' N=%s Hd=%s', tostring( Proc.vtN or V_NULL()), EgtIf( Proc.HeadDir, 'T', 'F'))
@@ -1084,6 +1164,9 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
-- se decorazione
elseif Decor.Identify( Proc) then
bOk, bDown = Decor.Classify( Proc)
-- se Variant
elseif Variant.Identify( Proc) then
bOk, bDown = Variant.Classify( Proc, b3Raw)
end
-- assegno risultato
if bOk then
@@ -1137,6 +1220,20 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
return bAllOk, bSomeDown, bSomeSide, bSplitRot
end
-------------------------------------------------------------------------------------------------------------
local function ClassifyTopology( vProc, nRawId)
local b3Raw = EgtGetRawPartBBox( nRawId)
local nRecognized = 0
for i = 1, #vProc do
local Proc = vProc[i]
if Topology.Classify( Proc, b3Raw) then
nRecognized = nRecognized + 1
end
end
return nRecognized
end
-------------------------------------------------------------------------------------------------------------
local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
local bOk = true
@@ -1280,6 +1377,10 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
elseif Decor.Identify( Proc) then
-- esecuzione decorazione
bOk, sErr = Decor.Make( Proc, nPhase, nRawId, nPartId)
-- se Variant
elseif Variant.Identify( Proc) then
-- esecuzione variante custom
bOk, sErr = Variant.Make( Proc, nPhase, nRawId, nPartId)
-- altrimenti feature sconosciuta
else
sErr = 'Error on process ' .. tostring( Proc.Id) .. ' unknown type (' .. tonumber( Proc.Grp) .. '-' .. tonumber( Proc.Prc) .. ')'
@@ -1521,7 +1622,7 @@ local function VerifyMortiseMirrored( Proc, vProc, b3Raw)
end
-- recupero eventuale utensile in doppio e suo diametro
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtFindToolInCurrSetup( sToolDoubleName) then
return
end
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
@@ -1590,7 +1691,7 @@ local function VerifyDtMortiseMirrored( Proc, vProc, b3Raw)
end
-- recupero eventuale utensile in doppio e suo diametro
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtFindToolInCurrSetup( sToolDoubleName) then
return
end
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
@@ -1671,7 +1772,7 @@ local function VerifyDrillMirrored( Proc, vProc, b3Raw)
local dToolTipLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - EgtTdbGetCurrToolParam( MCH_TP.LEN)
-- recupero eventuale utensile in doppio, suo diametro e massima lavorazione
local sToolDoubleName = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'DOUBLE', 's')
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtTdbGetCurrToolParam( MCH_TP.ACTIVE) then
if not sToolDoubleName or not EgtTdbSetCurrTool( sToolDoubleName) or not EgtFindToolInCurrSetup( sToolDoubleName) then
return
end
local dToolDoubleDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM, 'd')
@@ -1807,15 +1908,18 @@ function BeamExec.ProcessFeatures()
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, vMachineBeforeIntersectingDrillings = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT)
local vProc = 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)
vMachBeforeIntersDrillings = CalcHeadTailMachBeforeIntersDrillings( vProc, b3Raw)
SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachBeforeIntersDrillings)
end
-- verifica presenza di feature specchiate per eventuali lavorazioni simultanee
if BD.TWO_EQUAL_HEADS or BD.DOWN_HEAD then
SetMirroredFeatures( vProc, b3Raw)
end
-- classifico topologicamente le feature
ClassifyTopology( vProc, nRawId)
-- le ordino lungo X
OrderFeatures( vProc, b3Raw)
-- le classifico
+205 -95
View File
@@ -1,4 +1,4 @@
-- BeamLib.lua by Egaltech s.r.l. 2023/03/22
-- BeamLib.lua by Egaltech s.r.l. 2023/12/15
-- 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.
@@ -22,6 +22,14 @@
-- 2023/01/31 Aggiunta funzione ConvertToClosedCurve, precedentemente parte di ProcessMortise.Make
-- 2023/02/22 Modifiche a SetOpenSide, aggiunte ChangeOrOpenStart e CurveWithOnlyStraightLines.
-- 2023/06/12 In ChangeOrOpenStart corretta ricerca segmento più lungo.
-- 2023/09/13 Aggiunte funzioni Is3EdgesApprox e GetProcessAffectedFaces.
-- 2023/09/25 In GetFaceWithMostAdj aggiunta verifica sottosquadro anche per facce non adiacenti.
-- 2023/09/26 In GetFaceWithMostAdj gestito primo parametro anche come Proc; gestito caso strip con facce tutte in sottosquadro.
-- 2023/09/26 Spostata qui funzione IsFeatureCuttingEntireSection da BeamExec.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation. Se l'elevazione è già calcolata la recupera da Proc, altrimenti la calcola al momento.
-- 2023/12/15 Correzione a GetFaceWithMostAdj per calcoli con facce che fanno ombra.
-- 2024/01/08 Correzione a Is3EdgesApprox per casi in cui nAddGroup non esista ancora.
-- 2024/01/18 Aggiunta funzione GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- Tabella per definizione modulo
local BeamLib = {}
@@ -436,54 +444,22 @@ function BeamLib.GetBoxFaceNorm( b3Box, ptP, vtV)
end
---------------------------------------------------------------------
function BeamLib.GetFaceElevation( nSurfId, nFac, nPartId)
-- centro e normale della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFac, GDB_ID.ROOT)
if not ptC or not vtN then return 0 end
-- riferimento OCS della faccia per ricavare elevazione rispetto alla faccia della superficie
local frOCS = Frame3d( ptC, vtN)
local b3Box = EgtGetBBoxRef( nSurfId, GDB_BB.STANDARD, frOCS)
local dElev = b3Box:getMax():getZ()
-- se definito identificativo di pezzo
if nPartId then
-- se superficie con più facce
if EgtSurfTmFacetCount( nSurfId) > 1 then
-- determino elevazione del centro faccia rispetto al box del pezzo
local _, dCenElev = BeamLib.GetPointDirDepth( nPartId, ptC, vtN)
if dCenElev and dCenElev > dElev then
dElev = dCenElev
end
-- altrimenti superficie ad una sola faccia
else
-- determino elevazione box del pezzo rispetto alla faccia
local b3Solid = EgtGetBBoxRef( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD, frOCS)
local dSolidElev = b3Solid:getMax():getZ()
if b3Solid and dSolidElev > dElev then
dElev = dSolidElev
end
end
function BeamLib.GetFaceElevation( procOrProcId, nFacet, b3Solid)
local Proc, nProcId
if type( procOrProcId) == "table" then
Proc = procOrProcId
nProcId = Proc.Id
else
nProcId = procOrProcId
end
local dElevation
if not Proc or not Proc.Face or not Proc.Face[nFacet + 1].Elevation then
dElevation = EgtSurfTmFacetElevationInBBox( nProcId, nFacet, b3Solid, true, GDB_ID.ROOT)
else
dElevation = Proc.Face[nFacet + 1].Elevation
end
return dElev
end
---------------------------------------------------------------------
function BeamLib.GetOtherFaceElevation( nSurfId, nOtherSurfId, nOtherFac, nPartId)
-- centro e normale della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nOtherSurfId, nOtherFac, GDB_ID.ROOT)
if not ptC or not vtN then return 0 end
-- riferimento OCS della faccia per ricavare elevazione rispetto alla faccia della superficie
local frOCS = Frame3d( ptC, vtN)
local b3Box = EgtGetBBoxRef( nSurfId, GDB_BB.STANDARD, frOCS)
local dElev = b3Box:getMax():getZ()
-- se definito identificativo di pezzo
if nPartId then
-- determino elevazione del centro faccia rispetto al box del pezzo
local _, dCenElev = BeamLib.GetPointDirDepth( nPartId, ptC, vtN)
if dCenElev and dCenElev > dElev then
dElev = dCenElev
end
end
return dElev
return dElevation
end
---------------------------------------------------------------------
@@ -509,7 +485,9 @@ function BeamLib.GetFaceElevationFromPointDir( nSurfId, nPartId, ptC, vtN, nIdGe
end
---------------------------------------------------------------------
function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng)
local nSurfId = Proc.Id
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- verifica che la superficie non sia chiusa e quindi non lavorabile
if EgtSurfIsClosed( nSurfId) then
return
@@ -521,14 +499,17 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
end
-- recupero le normali delle facce
local vvtN = {}
local vPtC = {}
for i = 1, nFacCnt do
local vtN = EgtSurfTmFacetNormVersor( nSurfId, i - 1, GDB_ID.ROOT)
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, i - 1, GDB_ID.ROOT)
vvtN[i] = vtN ;
vPtC[i] = ptC
end
-- adiacenze e sottosquadra delle facce
local vAdj = {}
local vUcut = {}
local vOrtho = {}
local nFacesWithUnderCut = 0
for i = 1, nFacCnt do
-- recupero le adiacenze del loop esterno
local vFacAdj = EgtSurfTmFacetAdjacencies( nSurfId, i - 1)[1]
@@ -540,7 +521,7 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
end
end
vAdj[i] = nCount
-- ne determino eventuale sottosquadra ( dal valore passato o - 3deg) e ortogonalità
-- ne determino eventuale sottosquadro ( dal valore passato o - 3deg) e ortogonalità, per facce adiacenti
local bUcut = false
local bOrtho = true
for j = 1, #vFacAdj do
@@ -556,39 +537,63 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
end
end
end
-- determino evenutale sottosquadro per facce non adiacenti
for j = 1, nFacCnt do
local bIsFaceAdjacent = false
for k = 1, #vFacAdj do
if j - 1 == vFacAdj[k] then
bIsFaceAdjacent = true
break
end
end
if not ( bIsFaceAdjacent or ( j == i)) then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BeamLib.GetAddGroup( nPartId)
if not nAddGrpId then
EgtOutLog( 'Error : missing AddGroup')
return 0, 0, 0
end
-- verifico eventuale intersezione tra la faccia i-1 esima e la proiezione dell'altra sulla stessa
local nShadowFacetId = EgtCopySurfTmFacet( nSurfId, j - 1, nAddGrpId)
local nMasterContourId = EgtExtractSurfTmFacetLoops( nSurfId, i - 1, nAddGrpId)
local nShadowContourId = EgtExtractSurfTmLoops( nShadowFacetId, nAddGrpId)
EgtCutSurfTmPlane( nShadowFacetId, vPtC[i], -vvtN[i], false, GDB_RT.GLOB)
if nMasterContourId and nShadowContourId then
local nMasterSurfFlatId = EgtSurfFlatRegion( nAddGrpId, nMasterContourId)
local frOCSMaster = Frame3d( vPtC[i], vvtN[i])
EgtScale( nShadowContourId, frOCSMaster, 1, 1, 0, GDB_RT.GLOB)
EgtModifyCurveExtrusion( nShadowContourId, vvtN[i], GDB_RT.GLOB)
local nShadowSurfFlatId
-- se non troppo ortogonale (almeno 0.5deg di delta)
local dResV = vvtN[i] * vvtN[j]
if abs( dResV) > 0.087 then
EgtOffsetCurve( nShadowContourId, EgtIf( dResV > GEO.EPS_SMALL, - 50, 50) * GEO.EPS_SMALL)
local nShadowSurfFlatId = EgtSurfFlatRegion( nAddGrpId, nShadowContourId)
local bShadowSurfIsExternal = EgtSurfFrTestExternal( nMasterSurfFlatId, nShadowSurfFlatId)
if not bShadowSurfIsExternal then
bUcut = true
end
EgtErase( nShadowSurfFlatId)
end
EgtErase( nMasterSurfFlatId)
end
EgtErase( { nMasterContourId, nShadowContourId, nShadowFacetId})
end
end
if bUcut then
nFacesWithUnderCut = nFacesWithUnderCut + 1
end
vUcut[i] = bUcut
vOrtho[i] = bOrtho
end
-- se 4 facce tutte con adiacenza 2, allora è un tunnel
if nFacCnt == 4 then
if vAdj[1] == 2 and vAdj[2] == 2 and vAdj[3] == 2 and vAdj[4] == 2 then
-- se tutte le facce sono ortogonali tra loro esco con un flag che ne indica questa propietà
if vOrtho[1] == true and vOrtho[2] == true and vOrtho[3] == true and vOrtho[4] == true then
return -1, GEO.INFINITO, true
else
return -1, GEO.INFINITO
end
end
end
-- se 3 facce con una che ha 2 adiacenze e le altre hanno 1 adiacenza, allora è una semi-fessura
if bCompare3Fc and nFacCnt == 3 then
local nCount2Adc = 0
local nCount1Adc = 0
-- ottengo il numero di facce con due adiacenze e il numero di facce con una adiacenza
for i = 1, #vAdj do
if vAdj[i] == 2 then
nCount2Adc = nCount2Adc + 1
elseif vAdj[i] == 1 then
nCount1Adc = nCount1Adc + 1
end
end
-- se il numero di adiacenze corrisponde
if nCount2Adc == 1 and nCount1Adc == 2 then
if vOrtho[1] == true and vOrtho[2] == true and vOrtho[3] == true then
return -1, GEO.INFINITO, true
else
return -1, GEO.INFINITO
end
local bEveryFaceHasUndercut = ( nFacesWithUnderCut == nFacCnt)
-- tunnel o assimilabile
if Proc.Topology == 'Tunnel' or ( bCompare3Fc and Proc.Topology == 'Groove' and Proc.IsThrough) or ( Proc.Topology == 'Strip' and bEveryFaceHasUndercut) then
if Proc.IsParallel or Proc.AllRightAngles then
return -1, GEO.INFINITO, true
else
-- non gestito nella LapJoint
return -1, GEO.INFINITO
end
end
-- recupero le facce non in sottosquadra e con il maggior numero di adiacenze
@@ -618,7 +623,7 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
local dMinElev, dMinElev2 = GEO.INFINITO, GEO.INFINITO
local dtElev = {}
for i = 1, #nFacInd do
local dElev = BeamLib.GetFaceElevation( nSurfId, nFacInd[i], nPartId)
local dElev = BeamLib.GetFaceElevation( Proc, nFacInd[i], b3Solid)
table.insert( dtElev, dElev)
if dElev < dMinElev then
if dMinElev < dMinElev2 then
@@ -673,6 +678,13 @@ function BeamLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
end
---------------------------------------------------------------------
--- ritorna il riferimento di tipo OCS della faccia *nFacet* della trimesh *nSurfId* e le dimensioni orizzontale e verticale, eventualmente limitate dal grezzo *b3Raw*
---@param nSurfId integer Id della trimesh
---@param nFacet integer Indice 0-based della faccia della trimesh di cui restituire le informazioni
---@param b3Raw? BBox3d Eventuale box del grezzo per limitare le dimensioni
---@return Frame3d frHv riferimento faccia OCS
---@return number dDimH dimensione orizzontale OCS
---@return number dDmiV dimensione verticale OCS
function BeamLib.GetFaceHvRefDim( nSurfId, nFacet, b3Raw)
-- recupero centro e normale della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
@@ -751,13 +763,20 @@ function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
else
return -0.383
end
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM then
elseif b3Raw:getDimZ() < 300 then
-- N_HorAng < 10°
if vtN and ( abs( vtN:getY()) < 0.174) then
return -0.5
else
return -0.259
end
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM then
-- N_HorAng < 10°
if vtN and ( abs( vtN:getY()) < 0.174) then
return -0.342
else
return -0.259
end
else
-- N_HorAng < 10°
if vtN and ( abs( vtN:getY()) < 0.174) then
@@ -804,19 +823,6 @@ function BeamLib.GetDistanceToNextPart( nRawId, nPhase)
return dDistToNextPiece
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
@@ -834,6 +840,44 @@ function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd)
end
end
---------------------------------------------------------------------
---
---@param sMachining string nome della lavorazione di cui bloccare l'asse
---@param sBlockedAxis string rappresenta lo stato desiderato dell'asse bloccato, parallelo o perpendicolare all'asse rotante da cui dipende (*parallel* o *perpendicular*)
---@param b3Raw? BBox3d
---@param vtTool? Vector3d
---@param vtOut? Vector3d
---@return string # testo contenente il valore dell'asse rotante bloccato da scrivere nel parametro *MCH_MP.BLOCKEDAXIS* della lavorazione (es: 'A2=90')
function BeamLib.GetBlockedAxis( sMachining, sBlockedAxis, b3Raw, vtTool, vtOut)
-- informazioni sull'utensile della lavorazione
local nToolType, sHead
if EgtMdbSetCurrMachining( sMachining) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
nToolType = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
end
end
-- se presente funzione specifica nella macchina, la richiamo
if BD.GetBlockedAxis then
return BD.GetBlockedAxis( sHead, nToolType, sBlockedAxis, b3Raw, vtTool, vtOut)
-- sezione mantenuta per retrocompatibilità con GetChainSawBlockedAxis
elseif nToolType == MCH_TY.MORTISE_STD then
local nInd = EgtIf( sBlockedAxis == 'parallel', 0, 1)
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
return ''
end
---------------------------------------------------------------------
-- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa. La faccia di indice (0 based) fctExclude non viene considerata nella ricerca.
function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude)
@@ -1058,5 +1102,71 @@ function BeamLib.CurveWithOnlyStraightLines( nPathInt)
return true
end
---------------------------------------------------------------------
-- Funzione per determinare se la faccia ha lati molto corti (trascurabili) ed è quindi approssimabile ad una 3 facce
function BeamLib.Is3EdgesApprox( Proc, nFacet, nAddGrpId)
nAddGrpId = nAddGrpId or BeamLib.GetAddGroup( Proc.PartId)
if not nAddGrpId then
local nEdges = #(EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1])
return ( nEdges == 3)
end
local bResult = false
local nContourId, nContourCnt = EgtExtractSurfTmFacetLoops( Proc.Id, nFacet, nAddGrpId)
if not nContourId then return false end
EgtMergeCurvesInCurveCompo( nContourId)
-- recupero il numero effettivo di lati
local _, nEntityCount = EgtCurveDomain( nContourId)
local nEdges = nEntityCount
if nEntityCount and nEntityCount == 3 then
bResult = true
-- rimuovo i lati molto corti dal conteggio totale
elseif nEntityCount then
for i = 1, nEntityCount do
local dLength = EgtCurveCompoLength( nContourId, i - 1)
if dLength < 15 then nEdges = nEdges - 1 end
end
end
if nEdges == 3 then bResult = true end
-- cancello tutti i contorni appena creati
EgtErase( EgtTableFill( nContourId, nContourCnt))
return bResult
end
-------------------------------------------------------------------------------------------------------------
-- restituisce le facce della parte interessate dalla feature Proc
function BeamLib.GetProcessAffectedFaces( Proc)
local nBoxSolidId = EgtGetFirstNameInGroup( Proc.PartId or GDB_ID.NULL, 'Box')
local b3Part = EgtGetBBoxGlob( nBoxSolidId, GDB_BB.STANDARD)
local vtFacesAffected = { Top = false, Bottom = false, Front = false, Back = false, Left = false, Right = false}
if Proc.Box and not Proc.Box:isEmpty() then
if Proc.Box:getMax():getZ() > b3Part:getMax():getZ() - 500 * GEO.EPS_SMALL then
vtFacesAffected.Top = true
end
if Proc.Box:getMin():getZ() < b3Part:getMin():getZ() + 500 * GEO.EPS_SMALL then
vtFacesAffected.Bottom = true
end
if Proc.Box:getMin():getY() < b3Part:getMin():getY() + 500 * GEO.EPS_SMALL then
vtFacesAffected.Front = true
end
if Proc.Box:getMax():getY() > b3Part:getMax():getY() - 500 * GEO.EPS_SMALL then
vtFacesAffected.Back = true
end
if Proc.Box:getMin():getX() < b3Part:getMin():getX() + 500 * GEO.EPS_SMALL then
vtFacesAffected.Left = true
end
if Proc.Box:getMax():getX() > b3Part:getMax():getX() - 500 * GEO.EPS_SMALL then
vtFacesAffected.Right = true
end
end
return vtFacesAffected
end
-------------------------------------------------------------------------------------------------------------
-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra, rappresentata dalle sue dimensioni W e H
function BeamLib.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
-------------------------------------------------------------------------------------------------------------
return BeamLib
+2 -1
View File
@@ -1,5 +1,6 @@
-- FaceByPocket.lua by Egaltech s.r.l. 2023/04/04
-- Gestione svuotatura di feature con una faccia
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo
local FaceByPocket = {}
@@ -78,7 +79,7 @@ function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid,
end
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
local dElev = BL.GetFaceElevation( nSurfId, nFacet, nPartId)
local dElev = BL.GetFaceElevation( nSurfId, nFacet, b3Solid)
-- determino numero e valore degli step di lavorazione
local nSurfStep = ceil( dElev / dMaxDepth)
local dSurfStep = dElev / nSurfStep
+208 -163
View File
@@ -1,4 +1,4 @@
-- FacesBySaw.lua by Egaltech s.r.l. 2023/06/14
-- FacesBySaw.lua by Egaltech s.r.l. 2024/01/07
-- 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.
@@ -17,6 +17,15 @@
-- 2023/04/20 Alcune modifiche per gestire tagli con faceuse parallelo.
-- 2023/05/18 Imposto in ogni caso dVzLimDwnUp prima anche di bDownHead.
-- 2023/06/14 Aggiunta MakeParallelOne e tolti parametri nForceWorkSide, nForceSCC da MakeOne.
-- 2023/09/26 Piccola modifica per Turn su bInvert di MakeOne.
-- 2023/10/24 In MakeOne migliorata gestione taglio con percorso bilinea. Aggiunta funzione GetNameSolidFaceIncludingLine.
-- 2023/11/14 In MakeOne migliorato calcolo scelta soluzione per macchina TURN
-- 2023/11/28 In MakeTwo raffinamento calcolo vtRef per casi dubbi.
-- 2023/12/06 In CalcLeadInOutPerpGeom gestito caso in cui la geometria della feature esce dal grezzo.
-- 2023/12/30 Modifiche in CalcLeadInOutPerpGeom e CalcLeadInOutTangGeom con uso di EgtCAvToolPosBox.
-- 2024/01/07 Modifiche per OikosX (BD.TURN == 2).
-- 2024/01/18 Gestita lama con aggregato con asse bloccato per massimizzare capacità di taglio verticale, se da sotto.
-- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- Tabella per definizione modulo
local FacesBySaw = {}
@@ -34,6 +43,7 @@ local ML = require( 'MachiningLib')
---------------------------------------------------------------------
function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
EgtOutLog( 'FacesBySaw.MakeParallelOne', 3)
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
-- accetto solo facce perpendicolari all'asse X della trave
@@ -128,6 +138,20 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD
-- imposto allungamenti iniziale e finale
EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dAccStart)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dAccEnd)
-- imposto angolo 3° asse rot
local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5)
local vtTool
if nFaceUse == MCH_MILL_FU.PARAL_FRONT then
vtTool = Y_AX()
elseif nFaceUse == MCH_MILL_FU.PARAL_BACK then
vtTool = -Y_AX()
elseif nFaceUse == MCH_MILL_FU.PARAL_DOWN then
vtTool = Z_AX()
else
vtTool = -Z_AX()
end
local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX())
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtTool, vtOut))
-- eventuali note
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
-- eseguo
@@ -140,7 +164,32 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD
end
---------------------------------------------------------------------
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
local function GetNameSolidFaceIncludingLine( b3Solid, ptP1Comp, ptP2Comp)
-- se aperto su faccia fronte
if abs( b3Solid:getMin():getY() - ptP1Comp:getY()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMin():getY() - ptP2Comp:getY()) < 100 * GEO.EPS_SMALL then
return true, 'Front'
-- se aperto su faccia sopra
elseif abs( b3Solid:getMax():getY() - ptP1Comp:getY()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMax():getY() - ptP2Comp:getY()) < 100 * GEO.EPS_SMALL then
return true, 'Back'
-- se aperto su faccia retro
elseif abs( b3Solid:getMin():getZ() - ptP1Comp:getZ()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMin():getZ() - ptP2Comp:getZ()) < 100 * GEO.EPS_SMALL then
return true, 'Bottom'
-- se aperto su faccia sotto
elseif abs( b3Solid:getMax():getZ() - ptP1Comp:getZ()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMax():getZ() - ptP2Comp:getZ()) < 100 * GEO.EPS_SMALL then
return true, 'Top'
-- se aperto su faccia sinistra
elseif abs( b3Solid:getMin():getX() - ptP1Comp:getX()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMin():getX() - ptP2Comp:getX()) < 100 * GEO.EPS_SMALL then
return true, 'Left'
-- se aperto su faccia destra
elseif abs( b3Solid:getMax():getX() - ptP1Comp:getX()) < 100 * GEO.EPS_SMALL and abs( b3Solid:getMax():getX() - ptP2Comp:getX()) < 100 * GEO.EPS_SMALL then
return true, 'Right'
end
-- se non è sul bordo del solido
return false
end
---------------------------------------------------------------------
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth)
-- se lama con asse parallelo alla faccia, passo alla apposita funzione
if ( Par5 == MCH_MILL_FU.PARAL_DOWN or
Par5 == MCH_MILL_FU.PARAL_TOP or
@@ -151,6 +200,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
return MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
end
-- la lama ha asse perpendicolare alla faccia
EgtOutLog( 'FacesBySaw.MakeOne', 3)
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
-- risolvo parametro ambiguo
@@ -163,6 +213,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
nOrthoOpposite = Par5
vtOrthO = BL.GetVersRef( Par5)
end
EgtOutLog( 'VtOrthO='..tostring( vtOrthO)..' FaceUse='..tostring( nOrthoOpposite), 3)
-- verifico se testa da sotto oppure se lavorazione sotto con testa da sopra
if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end
local bDownHead = ( dVzLimDwnUp and dVzLimDwnUp < - 1.5)
@@ -183,7 +234,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
local bInvert = bForceInvert
-- se la lama ruota in senso antiorario inverto la direzione di lavorazione, per avere rotazione lama opposta a avanzamento
if bInvert == nil then
if not BD.TURN then
if not BD.TURN or abs( ptP2:getY() - ptP1:getY()) < 250 then
if bIsSawCCW ~= bDownUp then
bInvert = ( ptP2:getZ() < ptP1:getZ() + 100 * GEO.EPS_SMALL)
else
@@ -201,17 +252,28 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
local vtTg = ptP2 - ptP1 ; vtTg:normalize()
local dAllStart = 0
local dAllEnd = 0
local bIsBiLinea = false
local dCosAngleL1L2 = 0
local dDist1 = dist( ptP1, ptPm)
local dDist2 = dist( ptP2, ptPm)
-- verifico se la bilinea si trova sul bordo del solido, quindi è una geometria aperta
local nIdSolid = EgtGetParent( EgtGetParent( nSurfId))
-- recupero ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nIdSolid, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
-- controllo se le linee sono sul bordo della trave, quindi aperte
local bIsL1OnFace = GetNameSolidFaceIncludingLine( b3Solid, ptP1, ptPm)
local bIsL2OnFace = GetNameSolidFaceIncludingLine( b3Solid, ptPm, ptP2)
-- se bilinea, scarto la parte più allineata con la direzione ortogonale (se deviazione angolare oltre 20 deg o lunghezza minore di dSawDiam/2 * cos( 20/2)) ma maggiore di un minimo
if ( ( ptPm - ptP1) - ( ptPm - ptP1) * vtTg * vtTg):len() > 100 * GEO.EPS_SMALL then
bIsBiLinea = true
local vtTg1 = ptPm - ptP1 ; vtTg1:normalize()
local vtTg2 = ptP2 - ptPm ; vtTg2:normalize()
local dDist1 = dist( ptP1, ptPm)
local dDist2 = dist( ptP2, ptPm)
local dCosMax = 0.951 -- cos( 18°)
local dLenMin = 30
local dLenMax = max( 0.5 * dSawDiam * 0.17365 + 1, 2 * dLenMin)
--if vtTg1 * vtTg2 < dCosMax or ( dDist1 < dLenMax and dDist1 > dLenMin) or ( dDist2 < dLenMax and dDist2 > dLenMin) then
if vtTg1 * vtTg2 < dCosMax then
dCosAngleL1L2 = vtTg1 * vtTg2
if dCosAngleL1L2 < dCosMax then
local dOrtho1 = abs( vtTg1 * vtOrthO)
local dOrtho2 = abs( vtTg2 * vtOrthO)
if dOrtho1 < dOrtho2 or ( abs( dOrtho1 - dOrtho2) < 0.1 and dDist1 > 4 * dDist2) then
@@ -258,14 +320,50 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
-- parametri di attacco/uscita
local b3Box = BBox3d( b3Raw)
b3Box:expand( dCutSic)
local ptPa1 = ptP1 + dAccStart * vtTg
local ptPa2 = ptP2 + dAccEnd * vtTg
-- attacco perpendicolare
local dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio = FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
local dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio = FacesBySaw.CalcLeadInOutPerpGeom( ptPa1, ptPa2, vtV1, vtV2, vtN, dSawDiam / 2, vtRef, dCutExtra, b3Box)
local dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp)
local dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp)
-- attacco tangente
local dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp = FacesBySaw.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
local dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp = FacesBySaw.CalcLeadInOutTangGeom( ptPa1, ptPa2, vtN, dSawDiam / 2, vtRef, dCutExtra, b3Box)
local dLenLi2 = abs( dLi2Tang)
local dLenLo2 = abs( dLo2Tang)
-- se il lato non lavorato della bilinea è aperto, setto entrata/uscita con la stessa direzione
if bIsBiLinea then
-- angolo tra le due linee
local dCosAlpha = dCosAngleL1L2
local dSinAlpha = sqrt( max( 1 - dCosAlpha * dCosAlpha, 0))
-- se ho accorciato ingresso, setto componente tangente e perpendicolare sul percorso di entrata
if abs( dAllStart) > 100 * GEO.EPS_SMALL and bIsL1OnFace then
-- controllo prima che il secondo lato non sia già incluso nella lavorazione del primo
local dDistPtTang = dCosAlpha * dDist1
local dDistPtPerp = dSinAlpha * dDist1
local dDistToCenter = 0.5 * dSawDiam - dDistPtPerp
local dDistPointToCenter = sqrt( dDistPtTang * dDistPtTang + dDistToCenter * dDistToCenter)
-- se distanza al punto è maggiore del raggio lama, significa che non ho già lavorato, quindi calcolo entrata opportunamente
if dDistPointToCenter > 0.5 * dSawDiam then
dLiTang = -dAllStart * dCosAlpha
dLiPerp = dDist1 * dSinAlpha
end
end
-- se ho accorciato uscita, setto componente tangente e perpendicolare sul percorso di uscita
if abs( dAllEnd) > 100 * GEO.EPS_SMALL and bIsL2OnFace then
-- controllo prima che il secondo lato non sia già incluso nella lavorazione del primo
local dDistPtTang = dCosAlpha * dDist2
local dDistPtPerp = dSinAlpha * dDist2
local dDistToCenter = 0.5 * dSawDiam - dDistPtPerp
local dDistPointToCenter = sqrt( dDistPtTang * dDistPtTang + dDistToCenter * dDistToCenter)
-- se distanza al punto è maggiore del raggio lama, significa che non ho già lavorato, quindi calcolo uscita opportunamente
if dDistPointToCenter > 0.5 * dSawDiam then
dLoTang = -dAllEnd * dCosAlpha
dLoPerp = dDist2 * dSinAlpha
end
end
end
-- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale)
local bLioTang
local Ktp = 1.1
@@ -275,13 +373,32 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
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 and b3Box:getDimX() > BD.LEN_SHORT_PART) or
( abs( vtTg:getZ()) < 0.51 and ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) then
bLioTang = true
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
if BD.TURN then
( abs( vtTg:getZ()) < 0.51 and ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) or
Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo) or
( BD.TURN == 2 and vtRef:getZ() < -0.1)) then
if BD.TURN == 2 then
if vtTg:getY() < -0.1 then
bLioTang = 1
local dMove = dist( ptP1, ptP2)
dLiTang = -( dLi2Tang - dAccStart - dAccEnd + dMove)
-- dLiPerp rimane invariato
dLoTang, dLoPerp = dLo2Tang, dLo2Perp
else
bLioTang = 2
local dMove = dist( ptP1, ptP2)
dLiTang, dLiPerp = dLi2Tang, dLi2Perp
dLoTang = -( dLiTang - dAccStart - dAccEnd + dMove)
-- dLoPerp rimane invariato
end
elseif BD.TURN then
bLioTang = 2
local dMove = dist( ptP1, ptP2)
dLoTang = -( dLiTang + dAllStart - dAccStart + dAllEnd - dAccEnd + dMove)
dLiTang, dLiPerp = dLi2Tang, dLi2Perp
dLoTang = -( dLiTang - dAccStart - dAccEnd + dMove)
dLoPerp = BD.COLL_SIC
else
bLioTang = true
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
end
end
-- posizione braccio
@@ -294,11 +411,19 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end
else
if bLioTang then
--local vtTest = EgtIf( bInvert, vtTg, -vtTg)
if BD.TURN == 2 then
if vtOrthO:getZ() > -0.01 then
nSCC = MCH_SCC.ADIR_ZP
else
nSCC = MCH_SCC.ADIR_ZM
end
elseif bLioTang then
local vtTest = -vtTg
if abs( vtTest:getY()) > abs( vtTest:getZ()) then
nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
-- calcolo direzione risultante da versore utensile e direzione di lavorazione inverso
-- se la risultante tende verso Y positiva, scelgo soluzione dietro
local vtRes = vtTest + vtAux ; vtRes:normalize()
nSCC = EgtIf( vtRes: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
@@ -340,14 +465,18 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
-- offset longitudinale
EgtSetMachiningParam( MCH_MP.OFFSL, EgtIf( bDownUp, -dCutOffset, dCutOffset))
-- imposto attacco/uscita
if BD.TURN and bLioTang == 1 then EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TG_PERP) end
EgtSetMachiningParam( MCH_MP.LITANG, dLiTang)
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
if BD.TURN and bLioTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end
if BD.TURN and bLioTang == 2 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
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAllStart - dAccStart)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAllEnd - dAccEnd)
-- imposto angolo 3° asse rot
local sBlockedAxis = EgtIf( bMaximizeVerticalDepth, 'parallel', 'perpendicular')
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, sBlockedAxis, b3Raw, vtN, vtOrthO))
-- eventuali note
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
-- eseguo
@@ -361,6 +490,7 @@ end
---------------------------------------------------------------------
function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, bUpdateIng, bDownHead)
EgtOutLog( 'FacesBySaw.MakeTwo', 3)
-- bUpdateIng : parametro opzionale con default true
if bUpdateIng == nil then bUpdateIng = true end
-- recupero l'ingombro del grezzo di appartenenza
@@ -408,14 +538,14 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
vtRef[1] = vtN[1] ^ vtTg
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
vtRef[1]:normalize()
if abs( vtTg:getZ()) < 0.708 and abs( vtRef[1]:getZ()) < 0.577 and abs( abs( vtRef[1]:getX()) - abs( vtRef[1]:getY())) < 0.1 then
if abs( vtTg:getZ()) < 0.708 and abs( vtRef[1]:getZ()) < 0.577 and abs( abs( vtRef[1]:getX()) - abs( vtRef[1]:getY())) < 0.05 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( vtTg:getZ()) < 0.708 and abs( vtRef[2]:getZ()) < 0.577 and abs( abs( vtRef[2]:getX()) - abs( vtRef[2]:getY())) < 0.1 then
if abs( vtTg:getZ()) < 0.708 and abs( vtRef[2]:getZ()) < 0.577 and abs( abs( vtRef[2]:getX()) - abs( vtRef[2]:getY())) < 0.05 then
vtRef[2] = ptC[2] - ptM
vtRef[2]:normalize()
end
@@ -613,97 +743,49 @@ function FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vt
-- Sistema di riferimento intrinseco al taglio
local vtX = vtTg ^ vtN
local frFace = Frame3d( ptP1, vtX, vtTg, vtN)
EgtOutLog( 'Vref=' .. tostring( vtRef) .. ' V1=' .. tostring( vtV1) .. ' V2=' .. tostring( vtV2), 3)
local bRight = ( vtX * vtRef > 0)
EgtOutLog( 'LioPerp --> Vref=' .. tostring( vtRef) .. ' V1=' .. tostring( vtV1) .. ' V2=' .. tostring( vtV2), 3)
-- Versore di attacco e uscita
local dCos1 = vtV1 * vtRef
local dCos2 = vtV2 * vtRef
local vtLio
if abs( dCos1 - dCos2) < 0.001 then
if abs( vtV1:getZ()) < abs( vtV2:getZ()) then
vtLio = vtV1
else
vtLio = vtV2
end
vtLio = EgtIf( abs( vtV1:getZ()) < abs( vtV2:getZ()), vtV1, vtV2)
elseif dCos1 > dCos2 then
vtLio = vtV1
else
vtLio = vtV2
end
local bRight = ( vtX * vtLio > 0)
-- Versore di attacco e uscita nel riferimento intrinseco al taglio
local vtLioL = Vector3d( vtLio) ; vtLioL:toLoc( frFace)
-- Spostamento punti per effetto dell'extra o della deficienza di taglio
ptP1 = ptP1 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
ptP2 = ptP2 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
-- Non va considerata l'uscita dalla faccia sotto, pertanto va abbassata
-- 2021/02/26 Abilito anche uscita sotto
local b3MyBox = BBox3d( b3Box) ; --b3MyBox:Add( b3MyBox:getMin() - 1000 * Z_AX())
-- Attacco
local dLiTang = 10000
local dLiPerp = 10000
local bLiOk, _, vLiPar = EgtLineBoxInters( ptP1, vtLio, b3MyBox)
if bLiOk and #vLiPar > 0 then
-- con la prima faccia di uscita
local dLen = vLiPar[#vLiPar]
local ptInt = ptP1 + vtLio * dLen
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLio)
EgtOutLog( 'LiFaceNorm=' .. tostring( vtFN), 3)
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLio * vtFN)
local dLiLen = dLen + dAddLen
EgtOutLog( 'LeadIn Dist=' .. EgtNumToString( dLiLen), 3)
dLiTang = - dLiLen * vtLioL:getY()
dLiPerp = EgtIf( bRight, dLiLen, - dLiLen) * vtLioL:getX()
-- verifico se miglioro calcolando con faccia successiva
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
local bLiOk2, _, vLiPar2 = EgtLineBoxInters( ptP1, vtLio, b3Mod)
if bLiOk2 and #vLiPar2 > 0 then
local dLen2 = vLiPar2[#vLiPar2]
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP1 + vtLio * dLen2, vtLio)
EgtOutLog( 'LiFaceNorm2=' .. tostring( vtFN2), 3)
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLio * vtFN2)
local dLiLen2 = dLen2 + dAddLen2
EgtOutLog( 'LeadIn Dist2=' .. EgtNumToString( dLiLen2), 3)
local dLiTang2 = - dLiLen2 * vtLioL:getY()
local dLiPerp2 = EgtIf( bRight, dLiLen2, - dLiLen2) * vtLioL:getX()
if dLiLen2 < dLiLen then
dLiTang = dLiTang2
dLiPerp = dLiPerp2
end
end
end
-- Lunghezza di uscita
local dLoTang = 10000
local dLoPerp = 10000
local bLoOk, _, vLoPar = EgtLineBoxInters( ptP2, vtLio, b3MyBox)
if bLoOk and #vLoPar > 0 then
-- con la prima faccia di uscita
local dLen = vLoPar[#vLoPar]
local ptInt = ptP2 + vtLio * dLen
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLio)
EgtOutLog( 'LoFaceNorm=' .. tostring( vtFN), 3)
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLio * vtFN)
local dLoLen = dLen + dAddLen
EgtOutLog( 'LeadOut Dist=' .. EgtNumToString( dLoLen), 3)
dLoTang = dLoLen * vtLioL:getY()
dLoPerp = EgtIf( bRight, dLoLen, - dLoLen) * vtLioL:getX()
-- verifico se miglioro calcolando con faccia successiva
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
local bLoOk2, _, vLoPar2 = EgtLineBoxInters( ptP2, vtLio, b3Mod)
if bLoOk2 and #vLoPar2 > 0 then
local dLen2 = vLoPar2[#vLoPar2]
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP2 + vtLio * dLen2, vtLio)
EgtOutLog( 'LoFaceNorm2=' .. tostring( vtFN2), 3)
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLio * vtFN2)
local dLoLen2 = dLen2 + dAddLen2
EgtOutLog( 'LeadOut Dist2=' .. EgtNumToString( dLoLen2), 3)
local dLoTang2 = dLoLen2 * vtLioL:getY()
local dLoPerp2 = EgtIf( bRight, dLoLen2, - dLoLen2) * vtLioL:getX()
if dLoLen2 < dLoLen then
dLoTang = dLoTang2
dLoPerp = dLoPerp2
end
end
end
-- Centro lama a inizio fine percorso
local dOffs = ( -dCutExtra + dRad) * EgtIf( bRight, 1, -1)
local ptCen1 = ptP1 + dOffs * vtX
local ptCen2 = ptP2 + dOffs * vtX
-- Box del pezzo espansi ortogonalmente alle tre direzioni canoniche X, Y e Z
local b3BoxX = BBox3d( b3Box) ; b3BoxX:expand( 0, 1000, 1000)
local b3BoxY = BBox3d( b3Box) ; b3BoxY:expand( 1000, 0, 1000)
local b3BoxZ = BBox3d( b3Box) ; b3BoxZ:expand( 1000, 1000, 0)
-- Calcolo elevazione dei due centri
local dSawThick = 6
EgtCAvSetSawTool( dSawThick, 2 * dRad, dSawThick, 0, 0)
local dElev1 = min( EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxX, vtLio),
EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxY, vtLio),
EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxZ, vtLio))
EgtOutLog( 'Elev1=' .. EgtNumToString( dElev1), 3)
local dLiTang = -dElev1 * vtLioL:getY()
local dLiPerp = EgtIf( bRight, dElev1, -dElev1) * vtLioL:getX()
local dElev2 = min( EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxX, vtLio),
EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxY, vtLio),
EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxZ, vtLio))
EgtOutLog( 'Elev2=' .. EgtNumToString( dElev2), 3)
local dLoTang = dElev2 * vtLioL:getY()
local dLoPerp = EgtIf( bRight, dElev2, -dElev2) * vtLioL:getX()
return dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio
end
@@ -715,72 +797,35 @@ function FacesBySaw.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dRad, vtRef, dCutExt
-- Sistema di riferimento intrinseco al taglio
local vtX = vtTg ^ vtN
local frFace = Frame3d( ptP1, vtX, vtTg, vtN)
if ( vtX * vtRef < 0) then
vtX = - vtX
end
EgtOutLog( 'Vref=' .. tostring( vtRef) .. ' V1=' .. tostring( vtV1) .. ' V2=' .. tostring( vtV2), 3)
-- Spostamento punti per effetto dell'extra o della deficienza di taglio
ptP1 = ptP1 - vtX * dCutExtra
ptP2 = ptP2 - vtX * dCutExtra
-- Non va considerata l'uscita dalla faccia sotto, pertanto va abbassata
-- 2021/02/26 Abilito anche uscita sotto
local b3MyBox = BBox3d( b3Box) ; --b3MyBox:Add( b3MyBox:getMin() - 1000 * Z_AX())
-- Attacco
local dLiTang = 10000
local bRight = ( vtX * vtRef > 0)
EgtOutLog( 'LioTang --> Vref=' .. tostring( vtRef), 3)
-- Centro lama a inizio fine percorso
local dOffs = ( -dCutExtra + dRad) * EgtIf( bRight, 1, -1)
local ptCen1 = ptP1 + dOffs * vtX
local ptCen2 = ptP2 + dOffs * vtX
-- Box del pezzo espansi ortogonalmente alle tre direzioni canoniche X, Y e Z
local b3BoxX = BBox3d( b3Box) ; b3BoxX:expand( 0, 1000, 1000)
local b3BoxY = BBox3d( b3Box) ; b3BoxY:expand( 1000, 0, 1000)
local b3BoxZ = BBox3d( b3Box) ; b3BoxZ:expand( 1000, 1000, 0)
-- Calcolo elevazione dei due centri
local dSawThick = 6
EgtCAvSetSawTool( dSawThick, 2 * dRad, dSawThick, 0, 0)
local dElev1 = min( EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxX, -vtTg),
EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxY, -vtTg),
EgtCAvToolPosBox( ptCen1 + dSawThick * vtN, vtN, b3BoxZ, -vtTg))
EgtOutLog( 'Elev1=' .. EgtNumToString( dElev1), 3)
local dLiTang = dElev1
local dLiPerp = 0
local bLiOk, _, vLiPar = EgtLineBoxInters( ptP1, vtTg, b3MyBox)
if bLiOk and #vLiPar > 0 then
local dLen = vLiPar[1]
local ptInt = ptP1 + vtTg * dLen
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, -vtTg)
EgtOutLog( 'LiFaceNorm=' .. tostring( vtFN), 3)
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - ( vtX * vtFN)) / ( vtTg * vtFN)
local dLiLen = dLen + dAddLen
EgtOutLog( 'LeadIn Dist=' .. EgtNumToString( dLiLen), 3)
dLiTang = - dLiLen
-- verifico se miglioro calcolando con faccia successiva
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
local bLiOk2, _, vLiPar2 = EgtLineBoxInters( ptP1, vtTg, b3Mod)
if bLiOk2 and #vLiPar2 > 0 then
local dLen2 = vLiPar2[1]
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP1 + vtTg * dLen2, -vtTg)
EgtOutLog( 'LiFaceNorm2=' .. tostring( vtFN2), 3)
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - ( vtX * vtFN2)) / ( vtTg * vtFN2)
local dLiLen2 = dLen2 + dAddLen2
EgtOutLog( 'LeadIn Dist2=' .. EgtNumToString( dLiLen2), 3)
if -dLiLen2 < -dLiLen then
dLiTang = - dLiLen2
end
end
end
-- Lunghezza di uscita
local dLoTang = 10000
local dElev2 = min( EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxX, vtTg),
EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxY, vtTg),
EgtCAvToolPosBox( ptCen2 + dSawThick * vtN, vtN, b3BoxZ, vtTg))
EgtOutLog( 'Elev2=' .. EgtNumToString( dElev2), 3)
local dLoTang = dElev2
local dLoPerp = 0
local bLoOk, _, vLoPar = EgtLineBoxInters( ptP2, vtTg, b3MyBox)
if bLoOk and #vLoPar > 0 then
local dLen = vLoPar[#vLoPar]
local ptInt = ptP2 + vtTg * dLen
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtTg)
EgtOutLog( 'LoFaceNorm=' .. tostring( vtFN), 3)
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - ( vtX * vtFN)) / ( vtTg * vtFN)
local dLoLen = dLen + dAddLen
EgtOutLog( 'LeadOut Dist=' .. EgtNumToString( dLoLen), 3)
dLoTang = dLoLen
-- verifico se miglioro calcolando con faccia successiva
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
local bLoOk2, _, vLoPar2 = EgtLineBoxInters( ptP2, vtTg, b3Mod)
if bLoOk2 and #vLoPar2 > 0 then
local dLen2 = vLoPar2[#vLoPar2]
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP2 + vtTg * dLen2, vtTg)
EgtOutLog( 'LoFaceNorm2=' .. tostring( vtFN2), 3)
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - ( vtX * vtFN2)) / ( vtTg * vtFN2)
local dLoLen2 = dLen2 + dAddLen2
EgtOutLog( 'LeadOut Dist2=' .. EgtNumToString( dLoLen2), 3)
if dLoLen2 < dLoLen then
dLoTang = dLoLen2
end
end
end
return dLiTang, dLiPerp, dLoTang, dLoPerp
end
+266
View File
@@ -0,0 +1,266 @@
-- FeatureTopology.lua by Egaltech s.r.l. 2023/09/12
-- Libreria per classificazione topologica feature travi
-- 2023/09/26 Aggiunte topologie Strip e Cut.
-- 2023/09/27 Modificata GetFacesParallelToPart per tunnel, pocket e groove 3 lati
-- 2023/10/16 In GetFacesParallelToPart rimossa Pocket e aggiunto Rabbet al check solo direzione principale
-- 2023/11/03 In Classify ora si settano le AffectedFaces nella Proc, se non già presenti.
-- Aggiunta groove 2 facce, differenziata da rabbet.
-- Tabella per definizione modulo
local FeatureTopology = {}
-- Include
require( 'EgtBase')
-- Carico le librerie
local BL = require( 'BeamLib')
EgtOutLog( ' FeatureTopology started', 1)
---------------------------------------------------------------------
-- restituisce la matrice delle adiacenze di Proc dove i e j sono le facce e a(ij) è l'angolo tra di esse; 0 se nessuna adiacenza
local function GetAdjacencyMatrix( Proc)
local vAdj = {}
-- essendo la matrice simmetrica a diagonale nulla, ne calcolo solo la metà superiore
for i = 1, Proc.Fct do
vAdj[i] = {}
for j = i + 1, Proc.Fct do
_, _, _, vAdj[i][j] = EgtSurfTmFacetsContact( Proc.Id, i - 1, j - 1, GDB_ID.ROOT)
if not vAdj[i][j] then vAdj[i][j] = 0 end
end
end
-- riempio di conseguenza il resto della matrice
for i = 1, Proc.Fct do
vAdj[i][i] = 0
for j = i + 1, Proc.Fct do
vAdj[j][i] = vAdj[i][j]
end
end
return vAdj
end
---------------------------------------------------------------------
-- restituisce gli id delle facce di Proc che hanno il numero di adiacenze nAdj
function FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, nAdj)
if not vAdj then vAdj = GetAdjacencyMatrix( Proc) end
local nFct = #( vAdj or {})
local vFacesWithGivenAdj = {}
for i = 1, nFct do
local nAdjCount = 0
for j = 1, nFct do
if vAdj[i][j] and vAdj[i][j] ~= 0 then
nAdjCount = nAdjCount + 1
end
end
if nAdjCount == nAdj then
table.insert( vFacesWithGivenAdj, i - 1)
end
end
return vFacesWithGivenAdj
end
---------------------------------------------------------------------
-- restituisce true se Proc ha tutti gli angoli concavi (bAllConcave) e, nei casi in cui ha senso, se questi sono esattamente 90 deg (bAllRight)
local function AreAllAnglesConcaveOrRight( vAdj)
local bAllConcave, bAllRight = true, true
local nFct = #( vAdj or {})
for i = 1, nFct do
for j = 1, nFct do
-- se trovo un angolo convesso restituisco falso e esco subito
if vAdj[i][j] and vAdj[i][j] > 0 then
bAllConcave = false
bAllRight = false
break
elseif vAdj[i][j] and vAdj[i][j] ~= 0 and vAdj[i][j] + 90 > 500 * GEO.EPS_ANG_SMALL then
bAllRight = false
end
end
end
-- se 1 faccia oppure 2 facce con angolo convesso non ha senso ritornare valori per bAllRight
if nFct < 2 or ( nFct == 2 and vAdj[1][2] > 0) then
return bAllConcave
else
return bAllConcave, bAllRight
end
end
---------------------------------------------------------------------
-- restituisce true se almeno una delle dimensioni della feature è maggiore o uguale ad una delle dimensioni principali del pezzo (tolleranza 1 mm)
local function IsAnyDimensionLongAsPart( Proc)
local bResult = false
local nBoxSolidId = EgtGetFirstNameInGroup( Proc.PartId or GDB_ID.NULL, 'Box')
local b3Solid = EgtGetBBoxGlob( nBoxSolidId, GDB_BB.STANDARD)
if Proc.Box:getDimX() > b3Solid:getDimX() - 1000 * GEO.EPS_SMALL or
Proc.Box:getDimY() > b3Solid:getDimY() - 1000 * GEO.EPS_SMALL or
Proc.Box:getDimZ() > b3Solid:getDimZ() - 1000 * GEO.EPS_SMALL then
bResult = true
end
return bResult
end
---------------------------------------------------------------------
-- retituisce un vettore con gli indici (0 based) delle facce triangolari (o quasi) di Proc
local function GetTriangularFaces( Proc)
local vTriangularFaces = {}
for i = 1, Proc.Fct do
if BL.Is3EdgesApprox( Proc, i - 1) then
table.insert( vTriangularFaces, i - 1)
end
end
return vTriangularFaces
end
---------------------------------------------------------------------
-- restituisce un vettore contenente gli indici delle facce di Proc parallele ad una delle direzioni principali; il check varia in base alla famiglia topologica
local function GetFacesParallelToPart( Proc, sFamily, bIsThrough)
local vFacesParallelToPart = {}
for i = 0, Proc.Fct - 1 do
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i, GDB_ID.ROOT)
if sFamily == 'Rabbet' or sFamily == 'Bevel' or sFamily == 'DoubleBevel' or sFamily == 'Strip' or sFamily == 'Tunnel' or ( sFamily == 'Groove' and bIsThrough) then
local vTriangularFaces = GetTriangularFaces( Proc)
local bIsTriangularFace = false
-- verifico se la faccia è triangolare
for j = 1, #vTriangularFaces do
if i == vTriangularFaces[j] then
bIsTriangularFace = true
end
end
-- se faccia triangolare deve avere la normale parallela ad una direzione principale
if bIsTriangularFace then
if AreSameOrOppositeVectorApprox( vtN, X_AX()) or AreSameOrOppositeVectorApprox( vtN, Y_AX()) or AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
table.insert( vFacesParallelToPart, i)
end
-- altrimenti deve avere una componente della normale nulla
else
if abs( vtN:getX()) < 10 * GEO.EPS_SMALL or abs( vtN:getY()) < 10 * GEO.EPS_SMALL or abs( vtN:getZ()) < 10 * GEO.EPS_SMALL then
table.insert( vFacesParallelToPart, i)
end
end
else
-- la normale deve essere parallela ad una direzione principale
if AreSameOrOppositeVectorApprox( vtN, X_AX()) or AreSameOrOppositeVectorApprox( vtN, Y_AX()) or AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
table.insert( vFacesParallelToPart, i)
end
end
end
return vFacesParallelToPart
end
---------------------------------------------------------------------
-- restituisce una stringa con il nome esteso della topologia della feature
-- *famiglia-passante-angoli tutti concavi a 90deg-facce tutte parallele alle dimensioni principali-numero di facce*
local function GetTopologyLongName( sFamily, bIsThrough, bAllRightAngles, bIsParallel, nNumberOfFaces)
-- feature passante o cieca
local sThrough = '_'
if bIsThrough ~= nil then sThrough = EgtIf( bIsThrough, 'Through', 'Blind') end
-- tutti gli angoli della feature sono retti oppure no
local sAllRightAngles = '_'
if bAllRightAngles ~= nil then sAllRightAngles = EgtIf( bAllRightAngles, 'RightAngles', 'NotRightAngles') end
-- tutte le dimensioni della feature sono parallele agli assi principali del pezzo oppure no
local sParallel = '_'
if bIsParallel ~= nil then sParallel = EgtIf( bIsParallel, 'Parallel', 'NotParallel') end
local sLongName = sFamily .. '-' .. sThrough .. '-' .. sAllRightAngles .. '-' .. sParallel .. '-' .. nNumberOfFaces
return sLongName
end
---------------------------------------------------------------------
-- riconosce se Proc è una delle topologie standard e, in caso positivo, ne scrive le caratteristiche in campi specifici della Proc stessa restituendo true
function FeatureTopology.Classify( Proc, b3Raw)
-- la feature deve avere geometria
if not Proc.Box or Proc.Box:isEmpty() then
return false
end
-- se non richiesto (default true, quindi nil vale true), esco
if Proc.NeedTopology == false then
Proc.Topology = 'SPECIAL'
Proc.TopologyLongName = Proc.Topology
return true
end
-- se già calcolato, esco
if Proc.Topology then
return true
end
-- calcoli
if not Proc.AffectedFaces then Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc) end
local vAdj = GetAdjacencyMatrix( Proc)
local bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( vAdj)
local vTriangularFaces = GetTriangularFaces( Proc)
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc)
local vFacesWithOneAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 1)
local vFacesWithTwoAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 2)
local vFacesWithThreeAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 3)
local vFacesWithFourAdj = FeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, vAdj, 4)
local dRawW = b3Raw:getDimY()
local dRawH = b3Raw:getDimZ()
local bIsFeatureCuttingEntireSection = BL.IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
-- assegnazione tipologia
local sFamily
local bIsThrough
if Proc.Fct == 1 and bIsAnyDimensionLongAsPart and bIsFeatureCuttingEntireSection then
sFamily = 'Cut'
elseif Proc.Fct == 1 and bIsAnyDimensionLongAsPart then
sFamily = 'Bevel'
bIsThrough = true
elseif Proc.Fct == 2 and bAllAnglesConcave and #vTriangularFaces == 1 then
sFamily = 'Bevel'
bIsThrough = false
elseif Proc.Fct == 2 and bAllAnglesConcave and ( Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) and ( Proc.AffectedFaces.Front or Proc.AffectedFaces.Back) then
sFamily = 'Rabbet'
bIsThrough = true
elseif Proc.Fct == 2 and bAllAnglesConcave then
sFamily = 'Groove'
bIsThrough = true
elseif Proc.Fct == 2 and not bAllAnglesConcave and bIsAnyDimensionLongAsPart then
sFamily = 'DoubleBevel'
bIsThrough = true
elseif Proc.Fct == 3 and bAllAnglesConcave and #vFacesWithTwoAdj == 1 and #vTriangularFaces == 2 then
sFamily = 'Bevel'
bIsThrough = false
elseif Proc.Fct == 3 and bAllAnglesConcave and #vFacesWithTwoAdj == 1 and bIsAnyDimensionLongAsPart then
sFamily = 'Groove'
bIsThrough = true
elseif Proc.Fct == 3 and bAllAnglesConcave and #vFacesWithTwoAdj == 3 then
sFamily = 'Groove'
bIsThrough = false
elseif Proc.Fct == 4 and bAllAnglesConcave and #vFacesWithThreeAdj == 2 then
sFamily = 'Groove'
bIsThrough = false
elseif Proc.Fct == 4 and bAllAnglesConcave and #vFacesWithTwoAdj == 4 and bIsAnyDimensionLongAsPart then
sFamily = 'Tunnel'
bIsThrough = true
elseif Proc.Fct >= 4 and #vFacesWithOneAdj == 2 and bIsAnyDimensionLongAsPart then
sFamily = 'Strip'
bIsThrough = true
elseif Proc.Fct == 5 and bAllAnglesConcave and #vFacesWithFourAdj == 1 then
sFamily = 'Pocket'
bIsThrough = false
end
-- verifico se facce parallele a quelle della trave
local vFacesParallelToPart = GetFacesParallelToPart( Proc, sFamily, bIsThrough)
local bIsParallel = ( #vFacesParallelToPart == Proc.Fct)
-- assegnazioni
if sFamily then
Proc.Topology = sFamily
Proc.TopologyLongName = GetTopologyLongName( sFamily, bIsThrough, bAllRightAngles, bIsParallel, Proc.Fct)
Proc.IsThrough = bIsThrough
Proc.AllRightAngles = bAllRightAngles
Proc.IsParallel = bIsParallel
return true
else
Proc.Topology = 'OTHER'
Proc.TopologyLongName = Proc.Topology
return false
end
end
-------------------------------------------------------------------------------------------------------------
return FeatureTopology
+9 -7
View File
@@ -1,4 +1,4 @@
-- MachiningLib.lua by Egaltech s.r.l. 2022/05/07
-- MachiningLib.lua by Egaltech s.r.l. 2023/11/06
-- Libreria ricerca lavorazioni per Travi
-- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste.
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
@@ -7,6 +7,8 @@
-- 2022/12/28 Per FindMilling e FindDrilling possibilità di escludere la testa H2 dalla ricerca utensile.
-- 2023/01/31 Per FindPocketing implementata la possibilità di escludere le teste H2 o H3 dalla ricerca utensile.
-- 2023/07/28 Aggiunta gestione del tipo di foratura "Drill_AT".
-- 2023/11/06 Migliorie e correzioni alle forature con AngularTransmission ("_AT").
-- 2024/01/18 In FindSawing aggiunto il parametro opzionale dDepth.
-- Tabella per definizione modulo
local MachiningLib = {}
@@ -108,7 +110,7 @@ local function SetCurrMachiningAndTool( sMachName)
local sTool = EgtTdbGetToolFromUUID( sTuuid)
if not sTool then return false end
if not EgtTdbSetCurrTool( sTool) then return false end
local bActive = EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
local bActive = EgtFindToolInCurrSetup( sTool)
local sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
local nHead = tonumber( sHead:sub( 2, #sHead))
local bH2 = ( nHead >= 21 and nHead <= 29)
@@ -177,7 +179,7 @@ end
---------------------------------------------------------------------
function VerifyTool( MachiningType, sType, Params, bH2)
if MachiningType == MCH_MY.DRILLING then
if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'Drill_AT') or EgtStartsWith( sType, 'AngleDrill') then
if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'AngleDrill') then
return VerifyDrill( Params.Diam, Params.Depth, bH2)
elseif EgtStartsWith( sType, 'Pocket') then
return VerifyDrillPocket( Params.Diam, Params.Depth, bH2)
@@ -382,8 +384,8 @@ end
---------------------------------------------------------------------
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Drill_AT', 'Drill'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead, bExcludeH2)
if ( not MachiningName or MachiningName == '') and not bAngleTransmission then
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'Pocket', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
if ( not MachiningName or MachiningName == '') then
MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, EgtIf( bAngleTransmission, 'Pocket_AT', 'Pocket'), { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
end
if MachiningName and MachiningName ~= '' then
return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5
@@ -409,8 +411,8 @@ function MachiningLib.FindPocketing( sType, dMaxDiam, dDepth, dMaxTotLen, bTopHe
end
---------------------------------------------------------------------
function MachiningLib.FindSawing( sType)
return FindMachining( MCH_MY.MORTISING, sType)
function MachiningLib.FindSawing( sType, dDepth)
return FindMachining( MCH_MY.MORTISING, sType, { Depth = dDepth})
end
-------------------------------------------------------------------------------------------------------------
+32 -12
View File
@@ -21,6 +21,10 @@
-- 2023/06/19 Aggiunti tagli speciali per evitare il rischio che il cubetto rimanga appoggiato al motore.
-- 2023/08/01 Correzione su offset per taglio doppio di lato.
-- 2023/08/01 In caso di pezzi alti su macchina tipo PF i tagli doppi di lato non vengono usati, si usa il metodo standard.
-- 2023/09/12 In MakeFromTop abbassato a 590 mm il limite per convertire in LongCut.
-- 2023/10/27 In MakeFromTop corretto massimo materiale in caso di lavorazione da sotto.
-- 2023/12/07 Correzione in Classify in scelta ribaltamento trave quando si è in condizioni downUp.
-- 2024/01/18 Gestita superficie limitante opzionale da passare a diceCut.
-- Tabella per definizione modulo
local ProcessCut = {}
@@ -65,10 +69,22 @@ function ProcessCut.Classify( Proc, b3Raw)
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then
-- recupero i dati della lama
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
local sCutting = ML.FindCutting( sCutType, true, false)
local dMaxDepth = 0
local dMaxMat = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
end
end
-- calcolo l'ingombro orizzontale della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
-- 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
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale)
if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and abs( vtN:getY()) > 0.1 and dMaxMat < DimH + BD.CUT_EXTRA) then
return true, true
end
end
@@ -236,7 +252,7 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione con testa da sopra
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf)
-- ingombro del grezzo
b3Raw = b3Raw or EgtGetRawPartBBox( nRawId)
-- ingombro del pezzo
@@ -249,14 +265,15 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
if bFromBottom == nil then
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
local dMinFeatureLengthForLongCut = 590.000
-- verifico se da considerare taglio lungo ( non da sotto, inclinato non più di 30deg, largo come la trave e abbastanza lungo)
local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and
Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > dMinFeatureLengthForLongCut))
-- verifico se da considerare taglio lungo dal lato, solo per macchine tipo PF1250, inclinato non più di 30deg
local bLongCutFromSide = ( not bDownCut and ( BD.C_SIMM and BD.DOWN_HEAD and ( abs(vtN:getY()) > 0.865) and
Proc.Box:getDimZ() > b3Solid:getDimZ() - 10 * GEO.EPS_SMALL) and
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > dMinFeatureLengthForLongCut))
-- se taglio lungo e Q04 = 1 allora lancio il processo dell'L10
local bNoDicing = EgtGetInfo( Proc.Id, 'Q04', 'i') == 1
if bNoDicing then
@@ -345,7 +362,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
EgtOutLog( sErr)
return false, sErr
end
-- verifico se necessari tagli supplementari
-- verifico se necessari tagli supplementari o se presente superficie limitante
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
local vCuts = {}
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
@@ -356,6 +373,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
ptExtra = Point3d( b3Solid:getMin():getX() + 5*GEO.EPS_SMALL, ptMiddle:getY(), ptMiddle:getZ())
vtExtra = X_AX()
bAutoCalcSurf = false
-- superficie limitante
elseif nLimitingSurf then
ptExtra, vtExtra = EgtSurfTmFacetCenter( nLimitingSurf, 0, GDB_ID.ROOT)
end
-- verifico elevazione max del materiale tagliato
local dMaxElev
@@ -372,9 +392,9 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
dMaxElev = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
end
end
-- per macchina TURN aggiusto massima dimensione cubetto
-- per macchina TURN (ma non OikosX) aggiusto massima dimensione cubetto
local dNewDiceDim
if BD.TURN then
if BD.TURN and BD.TURN ~= 2 then
local dDimRef = GEO.INFINITO
if abs( vtN:getZ()) < 0.003 then
dDimRef = b3Raw:getDimZ()
@@ -554,7 +574,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
end
-- lavoro la faccia
local vtOrthoO
if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
if bFromBottom and dCutV < dMaxDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
vtOrthoO = -Z_AX()
elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or ( vtN:getX() > 0 and vtN:getZ() <= 0.708) or ( abs( vtN:getY()) < 0.1 and vtN:getZ() <= 0)) then
vtOrthoO = Z_AX()
@@ -775,7 +795,7 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng)
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf)
-- sovramateriale di coda
dOvmTail = dOvmTail or BD.OVM_MID
-- ingombro del grezzo
@@ -827,12 +847,12 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
local bNoDicing = false
-- se taglio con testa da sopra
if not bDownHead and not bDownTurn then
local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf)
bNoDicing = bNoDicing2
if not bOk then return false, sErr end
-- altrimenti taglio con testa da sotto
else
local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOk then return false, sErr end
end
-- Aggiornamento ingombro (se vero taglio o richiesto)
+16 -3
View File
@@ -2,6 +2,7 @@
-- Gestione calcolo doppi tagli di lama per Travi
-- 2022/08/29 Implementata la fresatura dal lato per tagli problematici per PF1250.
-- 2023/03/22 Eliminata SetOpenSide locale, si usa quella di libreria.
-- 2023/12/07 Correzione in Classify in scelta ribaltamento trave quando si è in condizioni downUp
-- Tabella per definizione modulo
local ProcessDoubleCut = {}
@@ -54,10 +55,22 @@ function ProcessDoubleCut.Classify( Proc, b3Raw)
local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN)
local bDownCut = ( vtN:getZ() <= dNzLimDwnUp)
if bDownCut then
-- recupero i dati della lama
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
local sCutting = ML.FindCutting( sCutType, true, false)
local dMaxDepth = 0
local dMaxMat = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
end
end
-- calcolo l'ingombro orizzontale della faccia
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, nFac)
-- 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
local _, DimH = BL.GetFaceHvRefDim( Proc.Id, nFac)
-- confronto questo ingombro con il doppio della massima dimensione del DiceCut (impossibile lavorare sotto da sopra se più di 2 tagli oppure se tipo PF, taglio inclinato in Y e non taglio singolo orizzontale)
if DimH > 2 * BD.MAX_DIM_DICE or ( BD.C_SIMM and abs( vtN:getY()) > 0.1 and dMaxMat < DimH + BD.CUT_EXTRA) then
return true, true
end
end
+6 -5
View File
@@ -1,6 +1,7 @@
-- 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)
-- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj.
-- Tabella per definizione modulo
local ProcessDovetail = {}
@@ -280,7 +281,7 @@ function ProcessDovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
-- deve avere la normale principale diretta verso la testa
local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc, nPartId)
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN:getZ() < BD.NZ_MINA and nFacInd2 then
ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
@@ -341,7 +342,7 @@ function ProcessDovetail.IsTailFeature( Proc, b3Raw)
end
end
-- deve avere la normale principale diretta verso la coda
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc, nPartId)
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN:getZ() < BD.NZ_MINA and nFacInd2 then
ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
@@ -933,10 +934,10 @@ local function MachSideFaces( Proc, nPartId, b3Raw, nFacetCnt, bForceUseRough,
end
else
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, sin(dSideAngle))
nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, sin(dSideAngle))
if not nFacInd or nFacInd < 0 then
-- provo eliminando i sottosquadra
nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, -2)
nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, -2)
if not nFacInd or nFacInd < 0 then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' MachSideFaces could not find reference face'
EgtOutLog( sErr)
@@ -1683,7 +1684,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
end
-- determino il massimo affondamento con l'utensile
local sMchFind = 'Long2Cut'
sMilling = ML.FindMilling( sMchFind)
local sMilling = ML.FindMilling( sMchFind)
if not sMilling then
local sErr = 'Milling not found in library : Error on Dovetail ' .. tostring( Proc.Id)
EgtOutLog( sErr)
+13 -9
View File
@@ -1,4 +1,4 @@
-- ProcessDrill.lua by Egaltech s.r.l. 2023/05/11
-- ProcessDrill.lua by Egaltech s.r.l. 2023/11/06
-- 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.
@@ -18,6 +18,8 @@
-- 2022/12/28 Implementata gestione forature in doppio
-- 2023/05/11 Se lavorazione in doppio e precedente no oppure di tipo diverso, forzo risalita a Zmax.
-- 2023/07/28 Aggiunta gestione rinvio 90deg solo per forature da sotto esattamente verticali.
-- 2023/09/26 Se errore in applicazione lavorazione si inverte e riprova solo se foratura singola su foro aperto.
-- 2023/11/06 Migliorata gestione dei fori con AngularTransmission.
-- Tabella per definizione modulo
local ProcessDrill = {}
@@ -132,8 +134,9 @@ function ProcessDrill.Split( Proc, b3Raw)
-- restituisco se va fatto in doppio (solo fori orizzontali)
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 bAngTransm = ( BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreSameOrOppositeVectorApprox( vtExtr, Z_AX()))
local bSlant = ( abs( vtExtr:getX()) > BD.DRILL_VX_MAX)
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and not bSlant)
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN or bAngTransm) and not bSlant)
end
---------------------------------------------------------------------
@@ -166,18 +169,19 @@ 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 or BD.TURN) 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 abs( Proc.Flg) == 2)))
local bAngTransm = ( BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreSameOrOppositeVectorApprox( vtExtr, Z_AX()))
-- 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
-- se da sotto e presente rinvio angolare verifico se c'è opportuna lavorazione
if BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreOppositeVectorApprox( vtExtr, Z_AX()) then
if bAngTransm then
return true, false, false
else
return true, true, false
end
else
return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN)
return true, not ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN or bAngTransm), ( BD.ROT90 or BD.DOWN_HEAD or BD.TURN)
end
else
return true, false, false
@@ -249,9 +253,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- verifico possibilità di foratura da sotto
local bDownDrill = ( BD.TURN or ( BD.DOWN_HEAD and ML.FindDrilling( dDiam, nil, false, true)))
-- se presente rinvio angolare
local bDrillAngTrasm = ( BD.ANG_TRASM and AreOppositeVectorApprox( vtExtr, Z_AX()))
local bDrillAngTrasm = ( BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreOppositeVectorApprox( vtExtr, Z_AX()))
-- verifico che il foro non sia fattibile solo da sotto
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill) and not bDrillAngTrasm
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill and not bDrillAngTrasm)
if bToInvert and ( not bOpen or Proc.Flg ~= 1) then
local sErr = 'Error : drilling from bottom impossible'
EgtOutLog( sErr)
@@ -460,7 +464,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eventuale inversione
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
@@ -516,7 +520,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
local bOk = ML.ApplyMachining( true, false)
if not bOk and bDownDrill then
if not bOk and bDownDrill and bOpen and abs( Proc.Flg) == 1 then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
+1
View File
@@ -35,6 +35,7 @@ local Q_RADIAL_OFFSET = 'Q06' -- d, valido solo per pocket
function ProcessFreeContour.Identify( Proc)
return ( ( Proc.Grp == 0 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 250)
end
---------------------------------------------------------------------
-- Verifica se feature di testa
function ProcessFreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
+91 -10
View File
@@ -8,6 +8,8 @@
-- 2022/11/10 Corrette finiture lama per BigSection con trave alta
-- 2023/04/20 Per travi alte aggiunti tagli orizzontali per ridurre le dimensioni degli scarti
-- 2023/08/02 Corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo
-- 2023/10/17 Corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative
-- 2024/01/18 Gestiti tagli verticali aggiuntivi per travi larghe.
-- Tabella per definizione modulo
local ProcessHeadCut = {}
@@ -18,6 +20,7 @@ local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
local Topology = require( 'FeatureTopology')
EgtOutLog( ' ProcessHeadCut started', 1)
@@ -150,6 +153,31 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
return true, nil
end
---------------------------------------------------------------------
-- tagli verticali aggiuntivi
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw )
local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local nVerticalCuts = ceil( dimH / ( BD.MAX_DIM_DICE)) - 1
local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1)
-- recupero il diametro dell'utensile
local dSawDiam = 400
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
end
end
local bOk, sErr
-- tagli orizzontali
for j = nVerticalCuts, 1, -1 do
local nFaceUse = MCH_MILL_FU.PARAL_FRONT
local dVerticalCutOffset = dVerticalSliceHeight * -j
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw)
if not bOk then return bOk, sErr end
end
return bOk, sErr
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut)
@@ -161,6 +189,8 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
if not bOkc then return bOkc, sErrC end
end
-- eventuali informazioni sul tipo di finitura
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
-- recupero la lavorazione
local sCutting = ML.FindCutting( 'HeadSide')
if not sCutting then
@@ -208,15 +238,16 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
if not bNeedHCut and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL then
return true
end
-- determino se più tagli con offset
-- determino se lo spessore del materiale da rimuovere è eccessivo e quindi vanno fatti più tagli con offset
local nCuts = max( ceil( dOvmHead / (( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP) + 0.5)), 1)
local dOffsL = dOvmHead / nCuts
local _, dimH, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local dMinOvmHeadForAddeddCuts = 10.123
-- se taglio per sezioni alte e larghe
if bBigSectionCut then
if dOvmHead > 0 then
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
-- se finitura con lama
if nQ05 == 1 or nQ05 == 0 then
if nQ05 < 2 then
local dSawThickCheck = dSawThick
if dSawThick2 > 0 and bDoubleHorizCut then
dSawThickCheck = min( dSawThick, dSawThick2)
@@ -229,7 +260,39 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
end
-- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard
if dMaxElev > dSawThickCheck then
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
local bOk, sErr
-- se trave larga effettuo tagli verticali aggiuntivi
if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then
-- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti
for i = nCuts, 1, -1 do
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
-- faccia di taglio all'offset corrente
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
local AddProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId}
Topology.Classify( AddProc, b3Raw)
local dCutOffset = ( i - 1) * dOffsL
local vtMove = Vector3d( dCutOffset, 0, 0)
EgtMove( AddId, vtMove, GDB_RT.GLOB)
-- eventuale faccia di taglio all'offset precedente, per limitare il dicing e evitare di tagliare i cubetti nel vuoto
local nLimitingSurf
if nCuts > 1 then
nLimitingSurf = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
local dLastCutOffset = i * dOffsL
local vtMoveLimitingSurf = Vector3d( dLastCutOffset - 10 * GEO.EPS_SMALL, 0, 0)
EgtMove( nLimitingSurf, vtMoveLimitingSurf, GDB_RT.GLOB)
local vtNLimitingSurf = EgtSurfTmFacetNormVersor( nLimitingSurf, 0)
if AreSameVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end
end
-- tagli verticali
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw)
if not bOk then return bOk, sErr end
-- tagli a cubetti con eventuale superficie limitante
bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT, nil, nLimitingSurf)
end
-- tagli aggiuntivi non necessari
else
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
end
return bOk, sErr
end
-- se finitura con truciolatore
@@ -267,17 +330,25 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra
-- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave
local dKL = dSawRad - dMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
-- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa
local dMinSawingLength = 5
if BD.C_SIMM then
dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL)
dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata
if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength
end
else
dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL)
dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita
if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength
end
end
end
-- per travi alte faccio dei tagli orizzontali aggiuntivi
local _, _, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local dMinOvmHeadForHorizontalCuts = 10.123
local bAreHorizontalCutsNeeded = ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForHorizontalCuts - 10 * GEO.EPS_SMALL)
local bAreHorizontalCutsNeeded = ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL)
if bAreHorizontalCutsNeeded then
local nHorizontalCuts = ceil( dimV / BD.MAX_DIM_DICE) - 1
local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1)
@@ -317,6 +388,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- eseguo i tagli necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
-- se trave larga effettuo tagli verticali aggiuntivi
if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw)
if not bOk then return bOk, sErr end
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw)
if not bOk then return false, sErr end
end
@@ -345,12 +421,17 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
-- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw, nil, true)
if not bOk then return false, sErr end
end
-- eseguo i tagli da sopra necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
-- se trave larga effettuo tagli verticali aggiuntivi
if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw)
if not bOk then return bOk, sErr end
end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
if not bOk then return false, sErr end
end
+424 -163
View File
@@ -1,4 +1,4 @@
-- ProcessLapJoint.lua by Egaltech s.r.l. 2023/07/19
-- ProcessLapJoint.lua by Egaltech s.r.l. 2023/09/26
-- Gestione calcolo mezzo-legno per Travi
-- 2019/10/08 Agg. gestione OpenPocket.
-- 2021/01/24 Con sega a catena ora sempre impostato asse A.
@@ -72,6 +72,22 @@
-- 2023/08/01 Aggiunta gestione rinvio angolare solo per tasche 5 lati, da sotto e perfettamente verticali.
-- 2023/08/02 Piccola correzione al calcolo della distanza di sicurezza in base al gambo dell'utensile.
-- 2023/08/02 Corretto incremento della profondità pari al raggio utensile per tunnel con sega a catena.
-- 2023/08/10 Modificata scelta SCC per tasche in Y+/- in coda o quasi (anche per relativi antischeggia con lama).
-- 2023/09/12 In MakeByPockets gestito correttamente il ritorno nil di GetUShapeWidth.
-- 2023/09/26 In MakeLongMoreFaces migliorata gestione spezzatura di Tunnel.
-- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj.
-- 2023/09/27 In MakeMoreFaces e Classify refactoring della gestione scanalatura chiusa.
-- 2023/09/27 In MakeLongMoreFaces aggiunto Topology.Classify alla Proc creata.
-- 2023/10/03 In MakePocket aggiunto messaggio in caso si rovini il pezzo successivo.
-- 2023/10/25 In LapJoint 2 facce longitudinali faccio di lama solo se taglio completamente. Altrimenti fresa.
-- 2023/10/27 In Lapjoint 2 facce con angolo > 90 deg, se forzata fresa, si svuota la faccia principale e si lavora poi la faccia inclinata.
-- 2023/11/03 Aggiunta MakeStaircaseStep per lavorazione con fresa + lama di gradini scala. Smusso opzionale.
-- 2023/11/06 In MakeStaircaseStep gestito ritorno.
-- 2023/11/06 Migliorie per lavorazione con AngularTransmission con FAST.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- 2023/12/01 In MakeMoreFaces, nelle OpenPocket, ammesso utensile con diametro fino a 3 volte la dimensione della tasca (era 2).
-- 2023/12/06 In VerifySideMillAsSaw, se SIDEDEPTH non definita, viene calcolata.
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- Tabella per definizione modulo
local ProcessLapJoint = {}
@@ -84,6 +100,7 @@ local Cut = require( 'ProcessCut')
local DoubleCut = require( 'ProcessDoubleCut')
local LongCut = require( 'ProcessLongCut')
local Long2Cut = require( 'ProcessLongDoubleCut')
local Topology = require( 'FeatureTopology')
EgtOutLog( ' ProcessLapJoint started', 1)
@@ -143,6 +160,7 @@ local function AssignQIdent( Proc)
Q_SIDE_ROUGH_TOOL = ''
Q_ANTISPLINT_TYPE = ''
Q_MAX_ELEVATION = 'Q10'
Q_STAIRCASE = ''
if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then
Q_FORCE_BLADE = 'Q01' -- i
@@ -156,7 +174,8 @@ local function AssignQIdent( Proc)
Q_USE_MILL = 'Q02' -- i
Q_USE_ROUGH_TOOL = 'Q03' -- i
Q_SIDE_ROUGH_TOOL = 'Q04' -- i
Q_BORE_ON_CORNER = 'Q06' -- i
Q_BORE_ON_CORNER = 'Q06' -- i
Q_STAIRCASE = 'Q09' -- i
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 25 then
Q_BORE_ON_CORNER = 'Q01' -- i
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 30 then
@@ -532,12 +551,14 @@ local function VerifySideMillAsSaw( Proc, nAddGrpId, vtN, dDiam, dFacElev)
local dToolDiamOnSide = 0
local dThickMillOnSide = 0
local dMaxDepthOnSide = 0
local dTDiamStem = 50
if EgtMdbSetCurrMachining( sMillingOnSide) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiamOnSide = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiamOnSide
dThickMillOnSide = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dThickMillOnSide
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or dMaxDepthOnSide
dTDiamStem = EgtTdbGetCurrToolParam( MCH_TP.STEMDIAM) or dTDiamStem
dMaxDepthOnSide = min( EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 999, 0.5 * ( dToolDiamOnSide - dTDiamStem)) or dMaxDepthOnSide
end
end
local bSpecialMillOnSide = ( dDiam > dThickMillOnSide - 10 * GEO.EPS_SMALL and dFacElev < dMaxDepthOnSide + 10 * GEO.EPS_SMALL)
@@ -632,7 +653,8 @@ function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
end
end
-- deve avere la normale principale diretta verso la testa
local nFacInd, dElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
Topology.Classify( Proc, b3Raw)
local nFacInd, dElev = BL.GetFaceWithMostAdj( Proc, nPartId)
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN and vtN:getX() < 0.499 then
return false
@@ -686,7 +708,8 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw)
end
end
-- deve avere la normale principale diretta verso la coda (oppure tunnel)
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
Topology.Classify( Proc, b3Raw)
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc, nPartId)
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
if vtN and vtN:getZ() < BD.NZ_MINA and nFacInd2 then
ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
@@ -735,7 +758,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
local nDeletedFace
-- recupero la faccia con il maggior numero di adiacenze e minor elevazione
local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( Proc, nPartId)
if not nFacInd or nFacInd < 0 then
if nFacInd == -1 then
bClosedOrthoFaces = nFacInd2
@@ -743,52 +766,19 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
return false
end
end
-- se è presente il rinvio angolare ed è una tasca cieca perfettamente verticale, da sotto, non ruoto
if BD.ANG_TRASM and Proc.Fct == 5 then
-- se è presente il rinvio angolare con lavorazioni di tasca ed è una tasca perfettamente verticale da sotto, non ruoto
if BD.ANG_TRASM and Proc.Fct >= 4 and not bClosedOrthoFaces then
local vtNBottomFace = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
if AreOppositeVectorApprox( vtNBottomFace, Z_AX()) then
if AreOppositeVectorApprox( vtNBottomFace, Z_AX()) and
( Proc.Fct >= 5 and ML.FindPocketing( 'Pocket_AT') or ( Proc.Fct < 5 and ML.FindPocketing( 'OpenPocket_AT'))) then
return true, false
end
end
-- se è una feature scanalatura (con 5 facce) e non è stata riconosciuta come fessura, eseguo altre verifiche
if Proc.Prc == 16 and Proc.Fct == 5 and not bClosedOrthoFaces then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
return false
end
-- dalla copia della superfice, ciclo eliminando una faccia per volta per verificare se trova fessura
for i = 1, Proc.Fct do
local nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
-- elimino una faccia
nDeletedFace = i - 1
if EgtSurfTmRemoveFacet( nNewProc, nDeletedFace) then
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
nFacInd, dElev, nFacInd2, dElev2 = BL.GetFaceWithMostAdj( nNewProc, nPartId)
if not nFacInd or nFacInd < 0 then
if nFacInd == -1 then
bClosedOrthoFaces = nFacInd2
EgtErase( nNewProc)
break
else
EgtErase( nNewProc)
return false
end
end
-- altrimenti esco
else
EgtErase( nNewProc)
break
end
end
-- se riconosciuta fessura ricalcolo l'elevazione dalla faccia di fondo
if bClosedOrthoFaces then
nFacInd = nDeletedFace
-- rendo nulla la faccia opzionale perchè si tratta di una fessura
nFacInd2 = nil
dElev = BL.GetFaceElevation( Proc.Id, nFacInd)
bClosedOrthoFaces = false -- non lo setto come tunnel
end
-- se scanalatura chiusa lavoro la faccia di fondo
if Proc.Topology == 'Pocket' and ( Proc.IsParallel or Proc.AllRightAngles) and not bClosedOrthoFaces then
nFacInd = Topology.GetFacesWithGivenAdjacencyNumber( Proc, nil, 4)[1]
nFacInd2 = nil
dElev = Proc.Face[ nFacInd + 1].Elevation
end
-- se facce formano un tunnel e sono ortogonali
if bClosedOrthoFaces then
@@ -1605,7 +1595,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
-- distanza di sicurezza per evitare collisioni
dCollSic = BL.CalcCollisionSafety( vtN1)
-- elevazione massima della faccia
dMaxElev = BL.GetFaceElevation( Proc.Id, nFacInd, nPartId)
dMaxElev = BL.GetFaceElevation( Proc, nFacInd, b3Solid)
-- ciclo tutta la tabella
local tPaths = {}
local ptIniPath
@@ -1650,7 +1640,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
-- distanza di sicurezza per evitare collisioni
dCollSic = BL.CalcCollisionSafety( vtOrtho)
-- calcolo elevazione dalla faccia trasversale aggiunta
local dSurfIntElev = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
local dSurfIntElev = BL.GetFaceElevation( nSurfInt, 0, b3Solid)
if bDoubleSide then
dMaxElev = dSurfIntElev
else
@@ -1661,13 +1651,13 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
-- se non è possibile svuotare completamente da una sola parte
if dTMaxDepth <= ( dMaxElev + BD.CUT_EXTRA + dCollSic) then
bDoubleSide = true
dMaxElev = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
dMaxElev = BL.GetFaceElevation( nSurfInt, 0, b3Solid)
else
dExtraDepth = dMaxElev - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
dExtraDepth = dMaxElev - BL.GetFaceElevation( nSurfInt, 0, b3Solid)
end
-- altrimenti non è stata fatta completamente calcolo la distanza tra faccia aggiunta e profondità superficie
else
dExtraDepth = dMaxElev - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
dExtraDepth = dMaxElev - BL.GetFaceElevation( nSurfInt, 0, b3Solid)
end
end
-- normale alla faccia aggiunta
@@ -2679,7 +2669,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
local bIs3Faces = ( Proc.Fct == 3)
if bIs3Faces then
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
local nFacInd1, dFacElev1, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId, bIs3Faces)
local nFacInd1, dFacElev1, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc, nPartId, bIs3Faces)
if not nFacInd1 or nFacInd1 < 0 then
if nFacInd1 == -1 then
bOrthoFaces = nFacInd2
@@ -2918,7 +2908,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, 0, - dSawWidth / 2))
end
-- imposto angolo 3° asse rot e eventuale angolo suggerito per inizio
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular'))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 1))
-- imposto offset radiale
local dOffs = ( i - 1) * dStep
@@ -2941,7 +2931,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel'))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -2986,7 +2976,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
-- imposto uso del lato faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular'))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtNL, vtOrtho, 1))
-- imposto offset radiale
local dOffs = ( i - 1) * dStep
@@ -3015,7 +3005,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel'))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtNL, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -3102,8 +3092,9 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe
end
---------------------------------------------------------------------
local function MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng, bOpenOutRaw, bLapJointAngTrasm)
local function MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng, bOpenOutRaw, bLapJointAngTrasm, nPhase, nRawId)
-- distanza dal pezzo successivo
local dDistToNextPiece = BL.GetDistanceToNextPart( nRawId, nPhase)
-- calcolo l'elevazione dal punto medio
local dElev
local dLenIn, dLedOut = BL.GetPointDirDepth( nPartId, ptPs, tvtN[2])
@@ -3173,7 +3164,10 @@ local function MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nFaceRef, sMchFin
if AreSameVectorApprox( tvtN[2], Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( tvtN[2]:getX()) < 0.1 then
nSCC = EgtIf( BL.IsPartFinalPhase( EgtGetCurrPhase()), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
local bNearTail = ( Proc.Box:getMax():getX() < b3Solid:getCenter():getX() + 50 and
Proc.Box:getMax():getX() - b3Solid:getMin():getX() < 1000)
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
nSCC = EgtIf( BL.IsPartFinalPhase( EgtGetCurrPhase()) or ( bNearTail and not bVeryShortPart), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif tvtN[2]:getY() > 0.1 then
nSCC = MCH_SCC.ADIR_YP
end
@@ -3223,6 +3217,11 @@ local function MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nFaceRef, sMchFin
return false, sErr
end
end
-- se la lavorazione rovina il pezzo successivo emetto warning
if ( not Proc.Tail or Proc.AdvTail) and Proc.AffectedFaces.Left and dDistToNextPiece < dDiamTool / 2 then
sWarn = 'Warning on pocketing ' .. sName .. ': machining can damage next piece. Minimum distance needed : ' .. ( 1 + dDiamTool / 2) .. ' mm'
EgtOutLog( sWarn)
end
if BD.TURN then
-- centro del pezzo
local ptCen = ORIG()
@@ -3266,7 +3265,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas
-- se l'angolo dalla verticale si discosta di più dell'angolo limite impostato, utilizzo la svuotatura
if cos( dDiffFromSqAng) < cos( dAngLimit) then
-- applico la svuotatura
local bOk, sWarn, sTuuidPk, dDiamTool, dElev = MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nSideFace, sMchFind, nUseRoughTool, sPocketing, dPrevFaceElev, tDimAndRef, dAng)
local bOk, sWarn, sTuuidPk, dDiamTool, dElev = MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nSideFace, sMchFind, nUseRoughTool, sPocketing, dPrevFaceElev, tDimAndRef, dAng, nil, nil, nPhase, nRawId)
if not bOk then
-- se ho id utensile e diametro è perchè non ha fatto svuotatura perchè la faccia è più stretta del diametro utensile
-- e provo ad inserire singola passata di testa
@@ -3475,7 +3474,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
end
if bIs3Faces then
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId, bIs3Faces)
local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc, nPartId, bIs3Faces)
if not nFacInd or nFacInd < 0 then
if nFacInd == -1 then
bOrthoFaces = nFacInd2
@@ -3498,8 +3497,8 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
dDimMin = 2 * dDimMin
-- se tre facce aumento il diametro di quanto possibile
elseif Proc.Fct == 3 then
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false)
local dWidth = GetUShapeWidth( Proc, nFacInd or -1)
local nFacInd = BL.GetFaceWithMostAdj( Proc, nPartId, false)
local dWidth = GetUShapeWidth( Proc, nFacInd or -1) or dDimMin
if dWidth > dDimMin then
dDimMin = min( 2 * dDimMin, dWidth)
end
@@ -3525,7 +3524,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
EgtInvertSurf( nSurfInt)
end
end
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId)
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
local bMakeContour = false
local sMilling
@@ -3872,7 +3871,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
-- se non completo e U, cerco di lavorare anche la faccia di fondo (con il massimo affondamento possibile)
if not bComplete and bIs3Faces then
-- recupero la faccia da lavorare
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId)
local vtN
local bPock3rd = false
if nFacInd then
@@ -3949,7 +3948,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
end
---------------------------------------------------------------------
local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacInd, sWarn, bMillDown, bReduceDepth)
local function ManageAntiSplintBySaw( Proc, b3Raw, b3Solid, bIsU, vtN, nFacInd, sWarn, bMillDown, bReduceDepth)
local bMadeASbyBld = false
local nNumFac = EgtIf( bIsU, 2, 1)
@@ -3989,9 +3988,18 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacInd, sWarn, bM
if abs( vtN:getZ()) > 0.63 or abs( vtN:getY()) > 0.63 then
-- se superficie principale parallela al piano XZ
if nPrefSide == 0 then
-- se facce praticamente verticali || mandrino a destra
-- se facce praticamente verticali ||
if abs( vtNFc:getZ()) < 0.1 then
nPrefSide = 2
-- se FAST, mandrino a destra o sinistra come svuotatura
if not BD.C_SIMM and not BD.TURN then
local bNearTail = ( Proc.Box:getMax():getX() < b3Solid:getCenter():getX() + 50 and
Proc.Box:getMax():getX() - b3Solid:getMin():getX() < 1000)
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
nPrefSide = EgtIf( BL.IsPartFinalPhase( EgtGetCurrPhase()) or ( bNearTail and not bVeryShortPart), 1, 2)
-- altrimenti sempre a destra
else
nPrefSide = 2
end
-- se facce inclinate \\ allora mandrino a destra (per essere verso l'alto)
elseif vtNFc:getX() * vtNFc:getZ() > 0 then
nPrefSide = 2
@@ -4238,7 +4246,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
dCheckDepth = 0.5 * dDepth
else
if not nPathInt then
dCheckDepth = BL.GetFaceElevation( Proc.Id, nFacInd)
dCheckDepth = BL.GetFaceElevation( Proc, nFacInd, b3Solid)
else
dCheckDepth = dDepth
end
@@ -4287,7 +4295,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
end
local ptIniPath
local nMaxLen = 0
dMaxElevMaster = BL.GetFaceElevation( Proc.Id, nFacInd)
dMaxElevMaster = BL.GetFaceElevation( Proc, nFacInd, b3Solid)
-- ciclo tutta la tabella
for i = 1, #tFacAdjMain do
-- le 2 facce di contatto devono essere perpendicolari o non sottosquadra rispetto alla faccia di fondo
@@ -4346,13 +4354,13 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
-- se non è possibile svuotare completamente da una sola parte
if dMaxDepth <= ( dMaxElevMaster + BD.CUT_EXTRA + dCollSic) then
bDoubleSide = true
dMaxElevMaster = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
dMaxElevMaster = BL.GetFaceElevation( nSurfInt, 0, b3Solid)
else
dExtraDepth = dMaxElevMaster - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
dExtraDepth = dMaxElevMaster - BL.GetFaceElevation( nSurfInt, 0, b3Solid)
end
-- altrimenti non è stata fatta completamente calcolo la distanza tra faccia aggiunta e profondità superficie
else
dExtraDepth = dMaxElevMaster - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
else
dExtraDepth = dMaxElevMaster - BL.GetFaceElevation( nSurfInt, 0, b3Solid)
end
end
vtN1 = Vector3d(vtOrtho)
@@ -4428,7 +4436,7 @@ local function MakeTunnelByChainSaw( Proc, sSawing, nLundIdFace, vtOrtho, dWorkD
EgtSetMachiningGeometry( {{ Proc.Id, nLundIdFace}})
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular'))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- imposto offset radiale
local dOffs = ( i - 1) * dStep
@@ -4444,7 +4452,7 @@ local function MakeTunnelByChainSaw( Proc, sSawing, nLundIdFace, vtOrtho, dWorkD
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel'))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -4488,7 +4496,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
local nBottomFace
local sMchFindBackUp
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc, nPartId)
if not nFacInd or nFacInd < 0 then
if nFacInd == -1 then
bClosedOrthoFaces = nFacInd2
@@ -4498,42 +4506,11 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
return false, sErr
end
end
-- se è una feature scanalatura (con 5 facce) e non è stata riconosciuta come fessura, eseguo altre verifiche
if Proc.Prc == 16 and Proc.Fct == 5 and not bClosedOrthoFaces then
-- dalla copia della superfice, ciclo eliminando una faccia per volta per verificare se trova fessura
for i = 1, Proc.Fct do
local nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
-- elimino una faccia
nBottomFace = i - 1
if EgtSurfTmRemoveFacet( nNewProc, nBottomFace) then
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( nNewProc, nPartId)
if not nFacInd or nFacInd < 0 then
if nFacInd == -1 then
bClosedOrthoFaces = nFacInd2
EgtErase( nNewProc)
break
else
EgtErase( nNewProc)
local sErr = 'Error : MakeMoreFaces could not find reference face'
EgtOutLog( sErr)
return false, sErr
end
end
-- altrimenti esco
else
EgtErase( nNewProc)
break
end
end
-- se riconosciuta fessura ricalcolo l'elevazione dalla faccia di fondo
if bClosedOrthoFaces then
nFacInd = nBottomFace
-- rendo nulla la faccia opzionale perchè si tratta di una fessura
nFacInd2 = nil
dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd)
bClosedOrthoFaces = false -- non setto come tunnel
end
-- se scanalatura chiusa lavoro la faccia di fondo
if Proc.Topology == 'Pocket' and ( Proc.IsParallel or Proc.AllRightAngles) and not bClosedOrthoFaces then
nFacInd = Topology.GetFacesWithGivenAdjacencyNumber( Proc, nil, 4)[1]
nFacInd2 = nil
dFacElev = Proc.Face[ nFacInd + 1].Elevation
end
-- se proviene da divisione in parti lungo X ed è un tunnel non è fattibile
if not bSinglePart and bClosedOrthoFaces then
@@ -4888,8 +4865,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
else
local bUseOtherFace
local bLapJointAngTrasm = false
-- se è presente il rinvio angolare ed è una tasca cieca perfettamente verticale, da sotto
if BD.ANG_TRASM and Proc.Fct == 5 and AreOppositeVectorApprox( vtN, Z_AX()) then
-- se è presente il rinvio angolare ed è una tasca perfettamente verticale, da sotto
if BD.ANG_TRASM and Proc.Fct >= 4 and AreOppositeVectorApprox( vtN, Z_AX()) then
bLapJointAngTrasm = true
-- se orientata verso il basso e non c'è testa da sotto, verifico l'alternativa
elseif vtN:getZ() < BD.NZ_MINA and not BD.DOWN_HEAD and nFacInd2 then
@@ -4926,7 +4903,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
return false, sErr
end
nFacInd = nFacAdj
dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd)
dFacElev = BL.GetFaceElevation( Proc, nFacInd, b3Solid)
ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
end
@@ -4949,7 +4926,6 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.342)
-- settaggio voluto da Alessandro/Fabio (per fare angoli con fresa piccola)
sMchFind = 'Pocket'
if bLapJointAngTrasm then sMchFind = 'Pocket_AT' end
local dDiam = min( dH, dV)
local bTailOnSide = ( Proc.Box:getMin():getX() - b3Solid:getMin():getX() < 0.1 and not Proc.Tail and not bAllWithEndCap)
if ( Proc.Fct == 1) or (( Proc.Fct == 2 or Proc.Fct == 3) and bIsL) or ((( Proc.Fct == 3 and bIsU) or ( Proc.Fct == 4 and not bTailOnSide)) and bSinglePart) then
@@ -4965,7 +4941,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- per rifinire gli angoli premio utensile diam 25 o da BD
dDiam = min( 2 * dDiam + 10 * GEO.EPS_SMALL, BD.MAXDIAM_POCK_CORNER)
else
dDiam = 2 * dDiam
dDiam = 3 * dDiam
end
end
sMchFindBackUp = sMchFind
@@ -4999,6 +4975,15 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
nUseRoughTool = 1
end
end
-- se abilitato rinvio da sotto
if bLapJointAngTrasm then
if not EgtEndsWith( sMchFind, '_AT') then
sMchFind = sMchFind .. '_AT'
end
if not EgtEndsWith( sMchFindBackUp, '_AT') then
sMchFindBackUp = sMchFindBackUp .. '_AT'
end
end
-- se da sotto, imposto massima lunghezza secondo la direzione
local dMaxTotLen
if bMillDown and BD.GetBottomToolMaxTotLen then
@@ -5147,12 +5132,12 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
local bMadeASbyBld = false
local bPassThrou = ( Proc.Box:getDimY() > b3Raw:getDimY() - 1 or Proc.Box:getDimZ() > b3Raw:getDimZ() - 1)
local bPassEdge = ((( bIsU and Proc.Fct == 3) or ( bIsL and Proc.Fct == 2)) and bSinglePart and Proc.Box:getDimX() < 0.9 * b3Raw:getDimX())
local nFacIndOri = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local nFacIndOri = BL.GetFaceWithMostAdj( Proc, nPartId)
local vtNOri = EgtSurfTmFacetNormVersor( Proc.Id, nFacIndOri, GDB_ID.ROOT)
if nChamfer < 2 and nQAntisplintResult == 1 and (( bIsU or bIsL) and ( bPassThrou or bPassEdge)) and ( vtNOri:getZ() > -0.087 or BD.DOWN_HEAD or BD.TURN) then
local bOk
local bSawDown = ( bMillDown and not bMillUp)
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtNOri, nFacIndOri, sWarn, bSawDown, true)
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, b3Solid, bIsU, vtNOri, nFacIndOri, sWarn, bSawDown, true)
if not bOk then return false, sWarn end
end
-- in base al flag interno e al numero di facce e se ha forma ad U
@@ -5175,12 +5160,12 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- 3 facce non a L ma con una faccia favorevole a Y, oppure
-- 4 facce
-- lancio la MakePocket ( lavorazione solo da un lato, fondo della tasca la faccia più favorevole a Y)
if bForceSideMill and (( Proc.Fct == 3 and bIsL) or ( ( Proc.Fct == 3 or Proc.Fct == 2) and abs( vtNFacApproxY:getY()) >= 0.707 ) or Proc.Fct == 4) then
if bForceSideMill and (( Proc.Fct == 3 and bIsL) or ( ( Proc.Fct == 3 or Proc.Fct == 2) and abs( vtNFacApproxY:getY()) >= 0.707 ) or ( Proc.Fct == 4 and Proc.Topology == 'Groove')) then
nFacInd, vtN, ptC = nFacApproxY, vtNFacApproxY, ptCFacApproxY
local tvtNx = {}
tvtNx[2] = vtN
local ptPs = ptC
dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd)
dFacElev = BL.GetFaceElevation( Proc, nFacInd, b3Solid)
dCollSic = BL.CalcCollisionSafety( tvtNx[2])
local dMachDepth = dFacElev + dCollSic
local frFacRec, dFacDim1, dFacDim2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
@@ -5202,7 +5187,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
end
vAdj[i] = nCount
if vAdj[i] == Proc.Fct - 1 and i ~= nFacInd + 1 then
dV = BL.GetFaceElevation( Proc.Id, i - 1)
dV = BL.GetFaceElevation( Proc, i - 1, b3Solid)
vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT)
end
end
@@ -5222,7 +5207,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
dToolMaxDiam = min ( dFacDim1, dFacDim2, dToolTargetDiam)
end
local _, sPocketing = VerifyPocket( Proc, dToolMaxDiam, dFacElev, nil, sMyMchFind)
bOk, sWarn2, sTuuidPk, dDiamTool, dDepth = MakePocket( Proc, nPartId, b3Solid, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap)
bOk, sWarn2, sTuuidPk, dDiamTool, dDepth = MakePocket( Proc, nPartId, b3Solid, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap, nil, nPhase, nRawId)
if not bOk then return false, sWarn2 end
if sWarn2 then
if not sWarn then sWarn = '' end
@@ -5285,7 +5270,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
sWarn = sErr
-- se ho antischeggia con fresa le inserisco
-- if nChamfer < 2 and nQAntisplintResult == 2 and ( bIsU or bIsL) then
local nFacIndOri, dFacElevOri = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local nFacIndOri, dFacElevOri = BL.GetFaceWithMostAdj( Proc, nPartId)
if nChamfer < 2 and nQAntisplintResult == 2 then
local bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacIndOri, nAddGrpId, bMillDown, dDiamTool, nil,
@@ -5386,12 +5371,12 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
local bMadeASbyBld = false
local bPassThrou = ( Proc.Box:getDimY() > b3Raw:getDimY() - 1 or Proc.Box:getDimZ() > b3Raw:getDimZ() - 1)
local bPassEdge = ((( bIsU and Proc.Fct == 3) or ( bIsL and Proc.Fct == 2)) and bSinglePart and Proc.Box:getDimX() < 0.9 * b3Raw:getDimX())
local nFacIndOri = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local nFacIndOri = BL.GetFaceWithMostAdj( Proc, nPartId)
local vtNOri = EgtSurfTmFacetNormVersor( Proc.Id, nFacIndOri, GDB_ID.ROOT)
if nChamfer < 2 and nQAntisplintResult == 1 and (( bIsU or bIsL) and ( bPassThrou or bPassEdge)) and ( vtNOri:getZ() > -0.087 or BD.DOWN_HEAD or BD.TURN) then
local bOk
local bSawDown = ( bMillDown and not bMillUp)
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtNOri, nFacIndOri, sWarn, bSawDown)
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, b3Solid, bIsU, vtNOri, nFacIndOri, sWarn, bSawDown)
if not bOk then return false, sWarn end
end
if nChamfer < 2 and nQAntisplintResult == 2 then
@@ -5432,16 +5417,16 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
dMachiningDepth = dFacElev + dCollSic
end
local bOk, sWarn2
bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, b3Solid, ptC, tvtNx, nFacInd, sMchFind, nUseRoughTool, sPocketing, dMachiningDepth, nil, nil, bAllWithEndCap, bLapJointAngTrasm)
bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, b3Solid, ptC, tvtNx, nFacInd, sMchFind, nUseRoughTool, sPocketing, dMachiningDepth, nil, nil, bAllWithEndCap, bLapJointAngTrasm, nPhase, nRawId)
if not bOk then return false, sWarn2 end
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
-- se ho più di 3 facce e non di forma ad u oppure ho 3 facce e di forma ad u
-- se ho più di 3 facce e non di forma ad u oppure ho 3 facce e di forma ad u oppure groove a 2 facce
-- e non sono stati inseriti antischeggia di lama
-- controllo se c'è una faccia non ortogonale alla principale e la lavoro con una contornatura o svuotatura
if ( ( Proc.Fct > 3 and not bIsU) or ( Proc.Fct == 3 and bIsU)) and not bMadeASbyBld then
if ( ( Proc.Fct >= 3 and not bIsU) or ( Proc.Fct == 3 and bIsU) or ( Proc.Fct == 2)) and not bMadeASbyBld then
-- Recupero le facce adiacenti alla principale
local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1]
if not vAdj or #vAdj == 0 then
@@ -5465,7 +5450,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
local ptPs = ( ptP1 + ptP2) / 2
local bOk, sWarn2
bOk, sWarn2 = MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtNx, nFacInd, vAdj[i], ptPs, tDimAndRef,
b3Raw, EgtIf( ( Proc.Fct == 3 and bIsU), 0, 2), nUseRoughTool, dAng, sPocketing, sTuuidPk, dFacElev)
b3Raw, EgtIf( ( Proc.Fct == 3 and bIsU) or Proc.Fct == 2, 0, 2), nUseRoughTool, dAng, sPocketing, sTuuidPk, dFacElev)
if not bOk then return bOk, sWarn2 end
if sWarn2 then
if not sWarn then sWarn = '' end
@@ -5530,62 +5515,104 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
local dDistToNextPiece = BL.GetDistanceToNextPart( nRawId, nPhase)
-- verifico se applicare gestione speciale delle giunzioni (U diretta come asse X)
local bAddEndCap = false
local bAddEndCapLeftSide, bAddEndCapRightSide = false, false
local dAddLen = 0
local bIsOpenU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
if bIsOpenU then
local ptC0, vtN0 = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
local ptC1, vtN1 = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, 2, GDB_ID.ROOT)
if vtN0:getX() < 0.0175 and vtN1:getX() < 0.0175 and vtN2:getX() < 0.0175 then
if abs( vtN0:getX()) < 0.0175 and abs( vtN1:getX()) < 0.0175 and abs( vtN2:getX()) < 0.0175 then
local dWidth = 0
if vtN0 * vtN1 < -0.9998 then
bAddEndCap = true
bAddEndCapLeftSide = true
dWidth = ( ptC1 - ptC0) * vtN0
elseif vtN0 * vtN2 < -0.9998 then
bAddEndCap = true
bAddEndCapLeftSide = true
dWidth = ( ptC2 - ptC0) * vtN0
elseif vtN1 * vtN2 < -0.9998 then
bAddEndCap = true
bAddEndCapLeftSide = true
dWidth = ( ptC2 - ptC1) * vtN1
end
dAddLen = min( dWidth, 100) / 2
end
end
-- verifico se applicare gestione speciale per tunnel
local nSurfBottomId
if Proc.Topology == 'Tunnel' then
bAddEndCapLeftSide = true
bAddEndCapRightSide = true
-- recupero centro e normale delle facce
local vtN = {}
for i = 1, Proc.Fct do
vtN[i] = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT)
end
-- calcolo l'orientamento del tunnel
local vtOrtho
local bAdj = EgtSurfTmFacetsContact( Proc.Id, 0, 1)
if bAdj then
vtOrtho = vtN[1] ^ vtN[2]
else
if Proc.Fct >= 3 then
vtOrtho = vtN[1] ^ vtN[3]
else
local sErr = 'Error : disconnected tunnel'
EgtOutLog( sErr)
return false, sErr
end
end
vtOrtho = EgtIf( abs( vtOrtho:getY()) > abs( vtOrtho:getZ()), -Y_AX(), -Z_AX())
local ptMaxBox = Proc.Box:getMax()
-- per creare le superfici di cap nei tunnel serve aggiungere una faccia di fondo
-- recupero il box della trave e lo ingrandisco di poco per essere sicuro di avere intersezione con il piano di fondo
local b3SolidExtended = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
b3SolidExtended:expand( 100 * GEO.EPS_SMALL)
-- superficie di fondo
nSurfBottomId = EgtSurfTmPlaneInBBox( nAddGrpId, ptMaxBox, vtOrtho, b3SolidExtended, GDB_ID.ROOT)
-- calcolo di quanto allargare le superfici
local dWidth = EgtIf( Proc.AffectedFaces.Front, Proc.Box:getDimZ(), Proc.Box:getDimY())
dAddLen = min( dWidth, 100) / 2
end
-- la divido in parti lungo X
local vAddId = {}
local bAllWithEndCap = bAddEndCap
local bAllWithEndCap = bAddEndCapLeftSide or bAddEndCapRightSide
local nPart = max( ceil( Proc.Box:getDimX() / BD.LONGCUT_MAXLEN), 2)
local dPartLen = Proc.Box:getDimX() / nPart
local Xmin = Proc.Box:getMin():getX()
-- trimesh per la creazione degli EndCap
local AddIdCopy = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
-- aggiunta di eventuale fondo alla trimesh per creare correttamente le superfici EndCap
if nSurfBottomId then EgtSurfTmAdd( AddIdCopy, nSurfBottomId) end
for i = 1, nPart do
local nCapIdLeftSide, nCapIdRightSide
-- eseguo divisione
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
if i > 1 or bAddEndCap then
-- definizione del piano
if i > 1 or bAddEndCapLeftSide then
-- definizione del piano sinsitro
local dAdd = EgtIf( i > 1, dAddLen, 0)
local ptOn = Point3d( Xmin - dAdd + ( i - 1) * dPartLen, 0, 0)
local vtN = -X_AX()
-- se richiesto, creazione tappo
local CapId
if bAddEndCap then
local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOn, vtN, AddId, nAddGrpId, GDB_RT.GLOB)
-- se richiesto, creazione tappo sinistro
if bAddEndCapLeftSide then
local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOn, vtN, AddIdCopy, nAddGrpId, GDB_RT.GLOB)
if nPnt == 0 and nCrv == 1 and nSrf == 0 then
EgtCloseCurveCompo( nFirstId)
CapId = EgtSurfTmByFlatContour( nAddGrpId, nFirstId)
if not CapId then bAllWithEndCap = false end
end
if nFirstId then
for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do
EgtErase( nId)
end
nCapIdLeftSide = EgtSurfTmByFlatContour( nAddGrpId, nFirstId)
if not nCapIdLeftSide then bAllWithEndCap = false end
end
if nFirstId then
for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do
EgtErase( nId)
end
end
end
-- taglio della superficie
EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB)
-- se esiste, aggiunta del tappo
if CapId then
AddId = EgtSurfTmBySewing( nAddGrpId, { AddId, CapId})
if i > 1 then
-- taglio della superficie lato sinistro
EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB)
end
-- se esiste, aggiunta del tappo sinistro
if nCapIdLeftSide then
AddId = EgtSurfTmBySewing( nAddGrpId, { AddId, nCapIdLeftSide})
-- se prima spezzatura, allungamento per non lasciare archi
if i == 1 then
local b3Box = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
@@ -5595,21 +5622,44 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end
if i < nPart then
local ptOn = Point3d( Xmin + i * dPartLen, 0, 0)
-- definizione del piano destro
local dAdd = EgtIf( i < nPart, dAddLen, 0)
local ptOn = Point3d( Xmin + dAdd + i * dPartLen, 0, 0)
local vtN = X_AX()
-- taglio della superficie lato destro
EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB)
-- se richiesto, creazione tappo destro
if bAddEndCapRightSide then
local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOn, vtN, AddIdCopy, nAddGrpId, GDB_RT.GLOB)
if nPnt == 0 and nCrv == 1 and nSrf == 0 then
EgtCloseCurveCompo( nFirstId)
nCapIdRightSide = EgtSurfTmByFlatContour( nAddGrpId, nFirstId)
if not nCapIdRightSide then bAllWithEndCap = false end
end
if nFirstId then
for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do
EgtErase( nId)
end
end
end
end
-- se esiste, aggiunta del tappo destro
if nCapIdRightSide then
AddId = EgtSurfTmBySewing( nAddGrpId, { AddId, nCapIdRightSide})
end
EgtSetName( AddId, 'AddPart_' .. tostring( Proc.Id) .. '_' .. tostring( i))
-- eseguo inserimento in modo da ordinare da X+ a X-
table.insert( vAddId, 1, AddId)
end
EgtErase( AddIdCopy)
-- applico le lavorazioni sulle diverse parti
local sWarn
local bPrevBhSideMill
for i = 1, #vAddId do
local b3Box = EgtGetBBoxGlob( vAddId[i], GDB_BB.STANDARD)
local nFct = EgtSurfTmFacetCount( vAddId[i])
local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, TotBox = Proc.Box, Fct = nFct, Flg = Proc.Flg}
local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, TotBox = Proc.Box, Fct = nFct, Flg = Proc.Flg, PartId = Proc.PartId}
Topology.Classify( AddProc, b3Raw)
-- lasciare il false nel sesto parametro (perchè internamente viene verificato se diverso da nil)
local bOk, sMyWarn
bOk, sMyWarn, bPrevBhSideMill = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId, dOvmHead, bAllWithEndCap, bPrevBhSideMill, bAllWithEndCap)
@@ -5636,6 +5686,199 @@ local function TestTwoFacesDownHead( Proc)
return bDownHead
end
---------------------------------------------------------------------
local function MakeStaircaseStep( Proc, nRawId, b3Raw, nPartId)
local sWarn
-- box della trave
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
-- angolo tra le facce
local _, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
-- l'angolo tra le facce deve essere compreso tra 80 e 95 deg
if ( dAng > -85 + 10 * GEO.EPS_ANG_SMALL) or ( dAng < -100 - 10 * GEO.EPS_ANG_SMALL) then return false end
-- normali delle facce
local vtNRiser = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT)
local vtNTread = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT)
-- la faccia 0 è l'alzata (faccia più verticale), la 1 la pedata; se così non è le scambio
local nFacetRiser, nFacetTread = 0, 1
if abs( vtNRiser:getZ()) > abs( vtNTread:getZ()) then
EgtSurfTmSwapFacets( Proc.Id, 0, 1)
vtNRiser, vtNTread = vtNTread, vtNRiser
end
-- riferimenti e dimensioni delle facce
local rfFacRiser, dHRiser, dVRiser = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacetRiser, GDB_ID.ROOT)
local rfFacTread, dHTread, dVTread = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacetTread, GDB_ID.ROOT)
-- recupero la fresatura
-- verifico se fresatura da sopra
local bIsMillingUpward = ( vtNTread:getZ() >= BD.NZ_MINA)
-- fresatura
local sMilling = ML.FindMilling( 'BirdsMouth', nil, nil, nil, nil, bIsMillingUpward, not bIsMillingUpward)
if not sMilling then
local sErr = 'Error : BirdsMouth not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- dati utensile
local dMillDiam = 50
local dMillMaxMat = 0
local dMillRotationSpeed = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMillMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMillMaxMat
dMillRotationSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or dMillRotationSpeed
end
end
-- recupero la lavorazione con lama
-- verifico se uso lama da sotto
local bCutDown = ( BD.DOWN_HEAD and rfFacTread:getVersZ():getZ() < - 0.5)
-- lavorazione con lama
local sCutting = ML.FindCutting( 'HeadSide', not bCutDown, bCutDown)
-- dati utensile
local dSawMaxDepth = 0
local dSawDiam = 400
local dSawRotationSpeed = 0
local dSawThick = 5
if sCutting then
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawMaxDepth = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth
dSawRotationSpeed = EgtTdbGetCurrToolParam( MCH_MP.SPEED) or dSawRotationSpeed
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
end
end
end
-- calcolo riduzione profondità lama in caso di angolo inferiore a 90deg
local dCutExtraSaw = 0
if dAng < -91 and dAng > -179 then
dCutExtraSaw = - dSawThick / tan( 180 + dAng)
end
-- eventuali smussi
-- 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
-- verifiche per smusso
local nChamfer, dDepthCham, sErrCham = EvaluateQParam( Proc)
-- lavorazione smussi
if nChamfer > 0 then
local _, _, _, vtOrtho, _, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham)
if nOk < 0 then return false, sErr end
if sErr then
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sErr, sErr)
end
end
-- fresatura della pedata per fare spazio alla lama
local dMillingDepth = dVTread - dSawMaxDepth + 10
-- divido in passate orizzontali
local nMillHorizontalSteps = ceil( ( dMillingDepth - 100 * GEO.EPS_SMALL) / ( dMillDiam * 0.6))
local dMillHorizontalStep = 0
if nMillHorizontalSteps > 1 then
dMillHorizontalStep = ( dMillingDepth - dMillDiam * 0.6) / ( nMillHorizontalSteps - 1)
end
for i = nMillHorizontalSteps, 1, -1 do
-- inserisco la lavorazione
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nFacetTread}})
-- imposto uso faccia
local nFaceUse = BL.GetNearestOrthoOpposite( vtNTread)
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto lato di lavoro e eventuale inversione
local bInvert = dMillRotationSpeed < 0
local nWorkSide = MCH_MILL_WS.LEFT
if bInvert then
nWorkSide = MCH_MILL_WS.RIGHT
end
EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkSide)
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
-- imposto posizione braccio porta testa
if vtNTread:getY() < GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- imposto attacchi e allungamenti
if nFacetTread then
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dMillDiam/2 + 10)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dMillDiam/2 + 10)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR)
EgtSetMachiningParam( MCH_MP.LITANG, 0)
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
end
-- imposto eventuale offset
EgtSetMachiningParam( MCH_MP.OFFSR, dVTread - dMillingDepth + ( i - 1) * dMillHorizontalStep)
-- se step verticale non presente, lo setto
local dMillVerticalStep = EgtGetMachiningParam( MCH_MP.STEP, 'd')
if not dMillVerticalStep or dMillVerticalStep <= 10 * GEO.EPS_SMALL then
dMillVerticalStep = 0.25 * dMillDiam
end
EgtSetMachiningParam( MCH_MP.STEP, dMillVerticalStep)
-- dichiaro non si generano sfridi per VMill
EgtSetMachiningParam( MCH_MP.USERNOTES, 'VMRS=0;')
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- eventuale segnalazione ingombro di testa o coda
UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
end
-- taglio di lama della pedata
-- calcolo faceuse
local nFaceUseTread = EgtIf( vtNRiser * Z_AX() > -GEO.EPS_SMALL, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
-- lavorazioni della faccia
for i = 2, 1, -1 do
local dCutRadialOffsetTread = - dSawMaxDepth / 2 * ( i - 1)
-- componente limite del vettore Z per lama downUp; impostata a -2 per non farla mai rientrare in quel caso
local dVzLimDwnUp = -2
local bOkSawTread, sErr = Fbs.MakeOne( Proc.Id, nFacetTread, sCutting, dSawDiam, nFaceUseTread, dVzLimDwnUp, dCutRadialOffsetTread + dCutExtraSaw, 0, 0, 0, 0, nil, b3Raw)
if not bOkSawTread then return false, sErr end
end
-- taglio di lama dell'alzata
-- calcolo faceuse
local nFaceUseRiser = EgtIf( vtNRiser * Z_AX() > -GEO.EPS_SMALL, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_TOP)
-- lavorazioni della faccia
for i = 2, 1, -1 do
local dCutRadialOffsetRiser = - dVRiser / 2 * ( i - 1)
-- componente limite del vettore Z per lama downUp; impostata a -2 per non farla mai rientrare in quel caso
local dVzLimDwnUp = -2
local bOkSawRiser, sErr = Fbs.MakeOne( Proc.Id, nFacetRiser, sCutting, dSawDiam, nFaceUseRiser, dVzLimDwnUp, dCutRadialOffsetRiser + dCutExtraSaw, 0, 0, 0, 0, nil, b3Raw)
if not bOkSawRiser then return false, sErr end
end
return true, sWarn
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
---------------------------------------------------------------------
@@ -5714,7 +5957,14 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- leggo i parametri Q per utilizzare la fresa di fianco e/o lama
local nUseSideTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0
local bUseBlade = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') == 1
return Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool)
local bOk, sMyWarn = Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool)
-- se non sono riuscito a farlo di lama, riprovo con la fresa
if not bOk and bUseBlade then
bUseBlade = false
return Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool)
else
return bOk, sMyWarn
end
-- prima faccia terminale
elseif b3Fac1:getDimX() < 1 and abs( vtN2:getX()) < GEO.EPS_SMALL then
-- la faccia 0 deve essere quella lunga
@@ -5792,13 +6042,24 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- due facce
elseif Proc.Fct == 2 then
-- se V passante e attiva Q per lavorazione speciale scala
if EgtGetInfo( Proc.Id, Q_STAIRCASE, 'i') == 1 and Proc.Topology == 'Groove' and Proc.IsThrough == true then
return MakeStaircaseStep( Proc, nRawId, b3Raw, nPartId)
end
-- se praticamente è lunga come la trave e sono due facce lunghe
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD)
local b3Fac2 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 1, GDB_BB.STANDARD)
if Proc.Box:getDimX() > 0.8 * b3Solid:getDimX() and
abs( b3Fac1:getDimX() - b3Fac2:getDimX()) < 50 and abs( b3Fac1:getCenter():getX() - b3Fac2:getCenter():getX()) < 50 then
local nUseSideTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0
return Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool)
local bOk, sMyWarn = Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool)
-- se non sono riuscito a farlo di lama, riprovo con la fresa
if not bOk and bUseBlade then
bUseBlade = false
return Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool)
else
return bOk, sMyWarn
end
-- altrimenti
else
-- verifico se da lavorare con testa da sotto
@@ -5809,9 +6070,9 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
if VerifyBHSideMill( Proc) then
return MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, true)
-- se ortogonali e non forzata lama, con fresa
elseif not bUseBlade and bAdj and abs( dAng + 90) < 1 then
elseif not bUseBlade then
-- se piccole
if Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN) then
if Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN) and bAdj and abs( dAng + 90) < 1 then
return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead)
else
return MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, true)
+34 -10
View File
@@ -29,6 +29,10 @@
-- 2023/05/03 Corretto SCC in caso di asse utensile allineato con Z.
-- 2023/05/19 Migliorato calcolo e verifica affondamento per lavorazione con lama con codolo in mezzo.
-- 2023/08/01 Ammesso uso lama da sotto fino a N +3deg in verticale.
-- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj.
-- 2023/10/24 Migliorata spezzatura taglio passante con due spezzoni
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- Tabella per definizione modulo
local ProcessLongCut = {}
@@ -437,7 +441,7 @@ end
-- Applicazione della lavorazione
local function MakeByPocketing( Proc, nPhase, nRawId, nPartId)
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId)
-- cerco la svuotatura opportuna
local sPocketing = ML.FindPocketing( 'OpenPocket', Proc.Box:getDimX())
if not sPocketing then
@@ -531,7 +535,7 @@ local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal, bShor
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular'))
local vtN = EgtSurfTmFacetNormVersor( nSurfId, 0, GDB_ID.ROOT)
local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
@@ -569,7 +573,7 @@ local function MakeSideFaceByChainSaw( nSurfId, dDepth, dOffs, dSal, dEal, bShor
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel'))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -592,6 +596,11 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- recupero lunghezza grezzo totale da info sulla macchinata
local dBarLen = EgtGetInfo( EgtGetCurrMachGroup(), 'BARLEN', 'd')
local dOvmHead = b3Raw:getMax():getX() - b3Solid:getMax():getX()
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
local _, dLen, dWidth = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT)
@@ -648,6 +657,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- leggo il parametro Q05 solo se è una vera longcut L010
elseif ProcessLongCut.Identify( Proc) then
nUseBlade = EgtGetInfo( Proc.Id, 'Q05', 'i') or 0
-- funzionamento Q05 --
-- 0: fresa; 1: lama solo se feature passante, faccia verso l'alto; 2: lama solo se feature passante, qualunque orientamento faccia; 3: lama con feature sia cieca che passante, faccia verso l'alto, lavorazione non rovina pezzo successivo; 4: lama con feature sia cieca che passante, qualunque orientamento faccia, lavorazione non rovina pezzo successivo
end
local bForceUseBladeOnNotThruFace
if nCustForceUseBladeOnNCF then
@@ -950,7 +961,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
if bForceUseBladeOnNotThruFace and ( bLimXmin or bLimXmax) then
local nCountMilHead = 0
-- determino la massima elevazione
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
local dElev = BL.GetFaceElevation( Proc, 0, b3Solid)
-- recupero la lavorazione
local sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bCanUseUnderBlade, bCanUseUnderBlade)
if not sMilling then
@@ -1168,6 +1179,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
-- imposto posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto angolo 3° asse rot
local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX())
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( EgtIf( bIsTopBladeCurrent, sCutting, sCuttingDn), 'perpendicular', b3Raw, vtN, vtOut))
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -1200,7 +1214,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then
-- determino la massima elevazione
local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
local dElev = BL.GetFaceElevation( Proc, 0, b3Solid)
-- recupero la lavorazione
local bDownHead = ( nSide == - 1)
sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut')
@@ -1310,8 +1324,18 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
dEndAccDist = min( dEndAccDist, dLen/2)
dStartAccDist = dLen - dEndAccDist
else
dStartAccDist = dLen/2
dEndAccDist = dStartAccDist
-- se c'è del grezzo aggiuntivo e, considerando il grezzo mi resta abbastanza materiale per pinzare, allora faccio spezzatura asimmetrica
if BD.MIN_CLAMPING_LEN and ( dBarLen - dLen) > dOvmHead + 100 * GEO.EPS_SMALL and ( dBarLen - dStartAccDist > BD.MIN_CLAMPING_LEN) then
dStartAccDist = dBarLen/2
dEndAccDist = dLen - dStartAccDist
-- se sono sul fronte, la spezzatura assimmetrica è inversa
if Proc.AffectedFaces.Front then
dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist
end
else
dStartAccDist = dLen/2
dEndAccDist = dStartAccDist
end
end
else
nC = 1
@@ -1360,9 +1384,9 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, 0}})
-- inverto se utensile antiorario per garantire senso di percorrenza migliore
local bInvert = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0
-- setto workside e eventuale inversione
local bInvert
if bInvert then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
EgtSetMachiningParam( MCH_MP.INVERT, true)
@@ -1534,7 +1558,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
local dDistToEnd = dToolDiam / 2
local dDistToEndDn = dToolDiamDn / 2
-- calcolo l'elevazione della faccia principale
local dFacElev = BL.GetFaceElevation( Proc.Id, 0, nPartId)
local dFacElev = BL.GetFaceElevation( Proc, 0, b3Solid)
-- 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))
+186 -23
View File
@@ -18,6 +18,11 @@
-- 2023/03/06 Correzione per i casi con lavorazione limitata.
-- 2023/03/23 Correzione per caso con doppia lama da sotto.
-- 2023/06/07 Sistemazione SCC per macchina TURN
-- 2023/10/24 Migliorata spezzatura taglio passante con due spezzoni
-- 2023/10/25 Se effettivamente un taglio longitudinale e lama non taglia completamente, limito la lavorazione. Altrimenti esco.
-- 2023/11/24 Aggiunta Q05 per utilizzo lama anche in feature cieche conme per LongCut.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- Tabella per definizione modulo
local ProcessLong2Cut = {}
@@ -311,12 +316,17 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster, nUseSideToolMaster)
-- recupero l'ingombro del grezzo di appartenenza
local b3Raw = EgtGetRawPartBBox( nRawId)
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- carico i dati delle face già inserite nelle opportune tabelle
local nFaceLimit, tFaceLong, ptC, vtN = IdentifyFaces( Proc)
local dLen = Proc.Box:getDimX()
-- recupero lunghezza grezzo totale da info sulla macchinata
local dBarLen = EgtGetInfo( EgtGetCurrMachGroup(), 'BARLEN', 'd')
local dOvmHead = b3Raw:getMax():getX() - b3Solid:getMax():getX()
-- verifico posizione (+1=sopra, -1=sotto, 0=sui lati)
local nSide = 0
if vtN[1]:getZ() > 0.0175 and vtN[2]:getZ() > 0.0175 then
@@ -360,11 +370,28 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
----------------------------------------------------------------------------------------------------------------------------------------
local bUseBlade
local nUseMillOnSide
local bForceUseBladeOnNotThruFace
-- se presenti utilizzo i parametri dell'eventuale lua "padre"
if bForcedBladeMaster ~= nil then
bUseBlade = bForcedBladeMaster
else
bUseBlade = EgtGetInfo( Proc.Id, 'Q01', 'i') == 1
local nUseBlade = EgtGetInfo( Proc.Id, 'Q05', 'i')
-- funzionamento Q05 --
-- 0: fresa; 1: lama solo se feature passante, faccia verso l'alto; 2: lama solo se feature passante, qualunque orientamento faccia; 3: lama con feature sia cieca che passante, faccia verso l'alto, lavorazione non rovina pezzo successivo; 4: lama con feature sia cieca che passante, qualunque orientamento faccia, lavorazione non rovina pezzo successivo
-- feature passante
if nFaceLimit == 0 then
if nUseBlade == 2 or nUseBlade == 4 or
( nSide == 1 and ( nUseBlade == 1 or nUseBlade == 3)) then
bUseBlade = true
end
-- feature cieca
else
if nUseBlade == 4 or
( nSide == 1 and ( nUseBlade == 3)) then
bUseBlade = true
bForceUseBladeOnNotThruFace = true
end
end
end
if nUseSideToolMaster ~= nil then
nUseMillOnSide = nUseSideToolMaster
@@ -411,8 +438,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
_, _, 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 ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
-- Se da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima
if ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
local sCutting
local dToolDiam = 0
@@ -458,23 +485,36 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
end
end
-- se la distanza dal pezzo successivo è inferiore della metà lama, do un warning
if ( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2) then
sWarn = 'Warning : Cut machining can damage next piece'
EgtOutLog( sWarn)
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo o grezzo riutilizzabile meno distante di metà raggio, setto la fine come limitata
if (( bCanUseBlade or bCanUseUnderBlade) and ( dDistToNextPiece < dToolDiam/2 or dDistToNextPiece < dToolDiamDn/2)) and nFaceLimit < 2 then
if bForceUseBladeOnNotThruFace then
nFaceLimit = nFaceLimit | 2
bForcedLim = true
else
sWarn = 'Warning on saw cut : Cut machining can damage next piece'
EgtOutLog( sWarn)
end
end
-- determino gli estremi
local dStartAccDist
local dEndAccDist
local bStartFixed
local bEndFixed
local dStartDist
local dEndDist
local dStartDistUp = 0
local dEndDistUp = 0
local dStartDistDn = 0
local dEndDistDn = 0
local dStartAccDistUp = BD.LONGCUT_ENDLEN
local dEndAccDistUp = BD.LONGCUT_ENDLEN
local dStartAccDistDn = BD.LONGCUT_ENDLEN
local dEndAccDistDn = BD.LONGCUT_ENDLEN
local nC
local dC
local dC
local nCUp
local dCUp
-- determino numero di parti
if bCanUseBlade then
nCUp = ceil( ( dLen - dStartAccDistUp - dEndAccDistUp) / BD.LONGCUT_MAXLEN)
@@ -562,7 +602,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtOutLog( sErr)
return false, sErr
end
local nFaceUse
local nFaceUse
local nFaceUse2
-- se ho solo lama da sotto
if bCanUseUnderBlade and not bCanUseBlade then
@@ -590,8 +630,47 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
elseif vtN[vOrd[j]]:getZ() < -0.707 then
nFaceSide = -1
end
-- ricavo box della faccia
-- ricavo informazioni della faccia
local b3Fac = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vOrd[j]-1, GDB_BB.STANDARD)
-- determino accorciamenti se lavorazione cieca
if bForceUseBladeOnNotThruFace then
if bCanUseBlade then
bStartFixed = true
-- limitato a destra
if ( nFaceLimit & 1) ~= 0 then
local dRadius = dToolDiam / 2
local dCat1 = dRadius - dOffset
dStartDistUp = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1))
bStartFixed = false
end
bEndFixed = true
-- limitato a sinistra
if ( nFaceLimit & 2) ~= 0 then
local dRadius = dToolDiam / 2
local dCat1 = dRadius - dOffset
dEndDistUp = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1))
bEndFixed = false
end
end
if bCanUseUnderBlade then
bStartFixed = true
-- limitato a destra
if ( nFaceLimit & 1) ~= 0 then
local dRadius = dToolDiamDn / 2
local dCat1 = dRadius - dOffset
dStartDistDn = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1))
bStartFixed = false
end
bEndFixed = true
-- limitato a sinistra
if ( nFaceLimit & 2) ~= 0 then
local dRadius = dToolDiamDn / 2
local dCat1 = dRadius - dOffset
dEndDistDn = sqrt( ( dRadius * dRadius) - (dCat1 * dCat1))
bEndFixed = false
end
end
end
-- ciclo sulle passate
for k = 1, 2 do
local dLioPerp = ( vWidth[vOrd[j]] - dDimStrip) / 2 + BD.CUT_SIC
@@ -608,6 +687,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistUp
dStartAccDist = dStartAccDistUp
dStartDist = dStartDistUp
dEndDist = dEndDistUp
elseif bCanUseUnderBlade and not bCanUseBlade then
sNameF = 'L2CD_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
nMchFId = EgtAddMachining( sNameF, sCuttingDn)
@@ -615,6 +696,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistDn
dStartAccDist = dStartAccDistDn
dStartDist = dStartDistDn
dEndDist = dEndDistDn
bMachDown = true
-- entrambe le possibilità di lama
else
@@ -627,6 +710,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistDn
dStartAccDist = dStartAccDistDn
dStartDist = dStartDistDn
dEndDist = dEndDistDn
bMachDown = true
-- se di fronte e prima faccia o dietro e seconda faccia, sta lavorando quella più in basso in Z (posizione)
elseif ( ( bFront and j == 1) or ( not bFront and j == 2)) and k == 2 then
@@ -636,6 +721,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistDn
dStartAccDist = dStartAccDistDn
dStartDist = dStartDistDn
dEndDist = dEndDistDn
bMachDown = true
-- se di fronte e seconda faccia o dietro e prima faccia, sta lavorando la faccia più in alto in Z (posizione)
elseif ( ( bFront and j == 2) or ( not bFront and j == 1)) and k == 1 then
@@ -645,6 +732,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistUp
dStartAccDist = dStartAccDistUp
dStartDist = dStartDistUp
dEndDist = dEndDistUp
-- se di fronte e seconda faccia o dietro e prima faccia, sta lavorando la faccia più in alto in Z (posizione)
elseif ( ( bFront and j == 2) or ( not bFront and j == 1)) and k == 2 then
sNameF = 'L2C_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring(j) .. '_' .. tostring( nM)
@@ -653,6 +742,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- setto le variabili delle distanze dagli estremi
dEndAccDist = dEndAccDistUp
dStartAccDist = dStartAccDistUp
dStartDist = dStartDistUp
dEndDist = dEndDistUp
end
end
if not nMchFId then
@@ -700,8 +791,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- settaggio di workside, uso faccia e eventuale inversione
-- limito opportunamente la lavorazione
local dSalInner, dSalOuter = - dEndAccDist - ( i - 2) * dC, 0
local dEalInner, dEalOuter = - dStartAccDist - ( nC - i - 1) * dC, 0
local dSalInner, dSalOuter = - dEndAccDist - ( i - 2) * dC, -dEndDist
local dEalInner, dEalOuter = - dStartAccDist - ( nC - i - 1) * dC, -dStartDist
local dSal = EgtIf( i == 1, dSalOuter, dSalInner)
local dEal = EgtIf( i == nC, dEalOuter, dEalInner)
if ( bFront and k == 1) or ( not bFront and k == 2) then
@@ -787,6 +878,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.LOPERP, dLioPerp)
-- imposto posizione braccio porta testa per non ingombrare agli estremi
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto angolo 3° asse rot
local bDownHead = not bIsTopBladeCurrent
local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX())
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut))
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -809,8 +904,57 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
end
end
end
-- eventuali puliture impronta lama
for j = 1, #vOrd do
if bForceUseBladeOnNotThruFace then
-- determino la massima elevazione
local dElev = 0
local dFacElev1 = BL.GetFaceElevation( Proc, tFaceLong[1], b3Solid)
local dFacElev2 = BL.GetFaceElevation( Proc, tFaceLong[2], b3Solid)
dElev = max( dFacElev1, dFacElev2)
-- recupero la lavorazione
local sMilling
local bDownHead = ( nSide == -1 and BD.DOWN_HEAD)
sMilling = ML.FindMilling( 'Long2Cut', dElev, nil, nil, nil, not bDownHead, bDownHead)
if not sMilling then
local sErr = 'Error : Long2Cut not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dToolDiam = 0
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- eventuale lavorazione della faccia limitante l'inizio (a destra)
if not bStartFixed then
MakeSideFace( Proc.Id, tFaceLong[vOrd[j]], 1, j, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown)
end
-- eventuale lavorazione della faccia limitante la fine (a sinistra)
if not bEndFixed then
MakeSideFace( Proc.Id, tFaceLong[vOrd[j]], -1, j, sMilling, dToolDiam, nSide, bIsAnyFaceUpsideDown)
end
end
end
-- altrimenti concavo
else
-- se effettivamente un taglio longitudinale e lama non taglia completamente, limito la lavorazione. Altrimenti esco.
for k = 1, #vOrd do
if vWidth[vOrd[k]] + BD.CUT_SIC > dMaxDepth then
if not( ProcessLong2Cut.Identify( Proc)) then
return false
else
local sWarn2 = 'Warning in ' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. ' : elevation (' .. EgtNumToString( vWidth[vOrd[k]], 1) .. ') bigger than max saw depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
end
end
-- si percorrono i lati alto e basso della faccia
for i = 1, nC do
-- Posizione braccio portatesta
@@ -851,16 +995,27 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- ciclo sulle passate
local dOffset
local dLioPerp
if j == 1 then -- il primo taglio lo faccio completo se angolo interno maggiore di 90
local dMinOffsBigFace = max( vWidth[vOrd[j]] - dMaxDepth, 0)
-- se la faccia è più grande del massimo materiale lama, allora limito lavorazione
if dMinOffsBigFace > 0 then
dOffset = dMinOffsBigFace
-- se angolo interno inferiore di 90° calcolo l'arretramento della lama + un piccolo delta di 0.3
if dAng < - ( 90 + 10 * GEO.EPS_SMALL) then
elseif dAng < - ( 90 + 10 * GEO.EPS_SMALL) then
dOffset = 0.3 + ((dToolThick* vtN[vOrd[1]]) * vtN[vOrd[2]] * vtN[vOrd[2]]):len()
else
dOffset = 0
end
dLioPerp = vWidth[vOrd[j]] + BD.CUT_SIC
else -- il secondo ridotto della distanza minima e della componente spessore della lama
dOffset = dDimStrip + ((dToolThick* vtN[vOrd[1]]) - (dToolThick* vtN[vOrd[1]]) * vtN[vOrd[2]] * vtN[vOrd[2]]):len()
local dMinOffsBigFace = max( vWidth[vOrd[j]] - dMaxDepth, 0)
-- se la faccia è più grande del massimo materiale lama, allora limito lavorazione
if dMinOffsBigFace > 0 then
dOffset = dMinOffsBigFace
else
dOffset = dDimStrip + ((dToolThick* vtN[vOrd[1]]) - (dToolThick* vtN[vOrd[1]]) * vtN[vOrd[2]] * vtN[vOrd[2]]):len()
end
dLioPerp = vWidth[vOrd[j]] - dOffset + BD.CUT_SIC
end
local dLioTang = 0
@@ -916,6 +1071,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- determino e imposto l'utilizzo della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, vFaceUse[vOrd[j]])
-- imposto angolo 3° asse rot
local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX())
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut))
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -930,9 +1088,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
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)
local dFacElev2 = BL.GetFaceElevation( Proc.Id, tFaceLong[2], nPartId)
-- 03/12/2020
local dFacElev1 = BL.GetFaceElevation( Proc, tFaceLong[1], b3Solid)
local dFacElev2 = BL.GetFaceElevation( Proc, tFaceLong[2], b3Solid)
-- se facce concave e a 90 gradi, prendo l'elevazione minima
if bOrtho then
dElev = min( dFacElev1, dFacElev2)
@@ -1048,8 +1205,14 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
dEndAccDist = min( dEndAccDist, dLen/2)
dStartAccDist = dLen - dEndAccDist
else
dStartAccDist = dLen/2
dEndAccDist = dStartAccDist
-- se c'è del grezzo aggiuntivo e, considerando il grezzo mi resta abbastanza materiale per pinzare, allora faccio spezzatura asimmetrica
if BD.MIN_CLAMPING_LEN and ( dBarLen - dLen) > dOvmHead + 100 * GEO.EPS_SMALL and ( dBarLen - dStartAccDist > BD.MIN_CLAMPING_LEN) then
dStartAccDist = dBarLen/2
dEndAccDist = dLen - dStartAccDist
else
dStartAccDist = dLen/2
dEndAccDist = dStartAccDist
end
end
else
nC = 1
@@ -1296,8 +1459,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
local dDistToEnd = dToolDiam / 2
local dDistToEndDn = dToolDiamDn / 2
-- calcolo l'elevazione della faccia principale
local dFacElev1 = BL.GetFaceElevation( Proc.Id, tFaceLong[vOrd[1]], nPartId)
local dFacElev2 = BL.GetFaceElevation( Proc.Id, tFaceLong[vOrd[2]], nPartId)
local dFacElev1 = BL.GetFaceElevation( Proc, tFaceLong[vOrd[1]], b3Solid)
local dFacElev2 = BL.GetFaceElevation( Proc, tFaceLong[vOrd[2]], b3Solid)
-- 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
local dFacElev = max( dFacElev1, dFacElev2)
+19 -11
View File
@@ -1,4 +1,4 @@
-- ProcessMortise.lua by Egaltech s.r.l. 2023/07/21
-- ProcessMortise.lua by Egaltech s.r.l. 2023/08/10
-- Gestione calcolo mortase per Travi
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
@@ -12,6 +12,8 @@
-- 2023/05/11 Se lavorazione in doppio e precedente no oppure di tipo diverso, forzo risalita a Zmax.
-- 2023/06/27 Esclusa la ricerca lati aperti per le mortase passanti, per le quali il contorno finisce sulla faccia e il riconoscimento sbaglia.
-- 2023/07/21 Correzioni per mortise passanti con curva Aux che guarda in basso.
-- 2023/08/10 Modificata scelta SCC per tasche in Y+/- in coda o quasi.
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- Tabella per definizione modulo
local ProcessMortise = {}
@@ -125,7 +127,7 @@ end
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- imposto angolo 3° asse rot
local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sMortising, 'perpendicular'))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- calcolo la lavorazione
if not ML.ApplyMachining( true, false) then
@@ -135,7 +137,7 @@ end
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sMortising, 'parallel'))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -469,11 +471,14 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local nSCC = MCH_SCC.NONE
if bPockAngTrasm then
nSCC = MCH_SCC.ADIR_NEAR
elseif not BD.C_SIMM then
if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then
elseif not BD.C_SIMM and not BD.TURN then
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN:getX()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_XP
elseif abs( vtN:getX()) < 0.1 then
local bNearTail = ( Proc.Box:getMax():getX() < b3Solid:getCenter():getX() and
Proc.Box:getMax():getX() - b3Solid:getMin():getX() < 1000)
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
nSCC = EgtIf( BL.IsPartFinalPhase( EgtGetCurrPhase()) or ( bNearTail and not bVeryShortPart), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtN:getY() < GEO.EPS_SMALL then
nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
@@ -551,11 +556,14 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
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 abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then
if not BD.C_SIMM and not BD.TURN then
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN:getX()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_XP
elseif abs( vtN:getX()) < 0.1 then
local bNearTail = ( Proc.Box:getMax():getX() < b3Solid:getCenter():getX() and
Proc.Box:getMax():getX() - b3Solid:getMin():getX() < 1000)
local bVeryShortPart = ( BD.LEN_VERY_SHORT_PART and b3Solid:getDimX() < BD.LEN_VERY_SHORT_PART)
nSCC = EgtIf( BL.IsPartFinalPhase( EgtGetCurrPhase()) or ( bNearTail and not bVeryShortPart), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtN:getY() < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YP
else
+2 -1
View File
@@ -9,6 +9,7 @@
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- 2022/11/03 Correzione per riconoscimento testa da sotto su fresatura.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo
local ProcessProfCamb = {}
@@ -285,7 +286,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- 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
if AddId and BL.GetFaceElevation( AddId, 0, b3Solid) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
+2 -1
View File
@@ -7,6 +7,7 @@
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- 2023/05/25 Sistemazione SCC per TURN.
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo
local ProcessProfConcave = {}
@@ -289,7 +290,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- 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
if AddId and BL.GetFaceElevation( AddId, 0, b3Solid) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
+2 -1
View File
@@ -7,6 +7,7 @@
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- 2023/05/25 Sistemazione SCC per TURN.
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo
local ProcessProfConvex = {}
@@ -289,7 +290,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- 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
if AddId and BL.GetFaceElevation( AddId, 0, b3Solid) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
+2 -1
View File
@@ -5,6 +5,7 @@
-- 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.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo
local ProcessProfFront = {}
@@ -236,7 +237,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- 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
if AddId and BL.GetFaceElevation( AddId, 0, b3Solid) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
+2 -1
View File
@@ -7,6 +7,7 @@
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
-- 2023/07/31 Correzione e semplificazione di ModifySideInvertLead per invert.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo
local ProcessProfHead = {}
@@ -271,7 +272,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- 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
if AddId and BL.GetFaceElevation( AddId, 0, b3Solid) > 20.0 then
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
+3 -3
View File
@@ -1,4 +1,4 @@
-- ProcessRidgeLap.lua by Egaltech s.r.l. 2023/05/18
-- ProcessRidgeLap.lua by Egaltech s.r.l. 2023/08/10
-- Gestione calcolo mezzolegno di testa per Travi
-- Tabella per definizione modulo
@@ -195,7 +195,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- aggiornamento ingombro di testa o coda
if Proc.Head then
local dHCI = 0
if abs( vtN[vFaceOrd[3]]:getZ()) > 0.1 then
if vtN[vFaceOrd[3]]:getZ() > 0.1 then
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
else
@@ -204,7 +204,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
BL.UpdateHCING( nRawId, dHCI)
elseif Proc.Tail then
local dTCI = 0
if abs( vtN[vFaceOrd[3]]:getZ()) > 0.1 then
if vtN[vFaceOrd[3]]:getZ() > 0.1 then
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
else
+16 -10
View File
@@ -1,4 +1,4 @@
-- ProcessRoundArch.lua by Egaltech s.r.l. 2023/05/18
-- ProcessRoundArch.lua by Egaltech s.r.l. 2023/12/07
-- Gestione calcolo archi per Travi
-- Tabella per definizione modulo
@@ -118,10 +118,13 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- recupero i dati dell'utensile
local dMaxDepth = 0
local bCW = true
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end
end
-- ne verifico la lunghezza per eventuale spezzatura e lavorazione in doppio
@@ -180,6 +183,10 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end
end
-- se lavorazione in doppio senza codolo, aggiungo sovrapposizione
if nDouble == 2 and dDimStrip < 10 * GEO.EPS_SMALL then
dDepth = dDepth + BD.MILL_OVERLAP / 2
end
-- se utensile orizzontale verso Y+, non in doppio e codolo da lasciare, devo invertire per lavorare sempre da Y-
if vtExtr:getY() > 0.707 and nDouble == 1 and bStripOnSide then
bToolInv = true
@@ -188,7 +195,7 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
for i = 1, nStep do
for j = 1, nDouble do
-- inserisco la lavorazione
local sName = 'Free_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local sName = 'Arch_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
@@ -212,20 +219,19 @@ function ProcessRoundArch.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
-- se seconda passata, inverto direzione di lavoro
if j == 2 then
EgtSetMachiningParam( MCH_MP.INVERT, true)
if ( j == 1 and not bToolInv) or ( j == 2 and bToolInv) then
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
else
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
end
-- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- assegno lato di lavoro
if bToolInv then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
else
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
-- assegno lato di lavoro (per avere lavorazione climb)
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
-- posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM and not BD.TURN then
nSCC = MCH_SCC.ADIR_XP
if Proc.Head then
nSCC = MCH_SCC.ADIR_XP
elseif Proc.Tail then
+4
View File
@@ -2,6 +2,7 @@
-- Gestione calcolo taglio di lama per Travi
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe).
-- 2022/12/19 Aggiunta gestione testa da sotto.
-- 2024/01/18 Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- Tabella per definizione modulo
local ProcessSawCut = {}
@@ -229,6 +230,9 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto uso della faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX())
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtN, vtOut))
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
+169 -47
View File
@@ -13,6 +13,10 @@
-- 2023/05/09 Aggiunta richiesta risalita preliminare a Zmax per tagli da sopra su macchine PF e ONE.
-- 2023/06/13 Corrette note Precut e Cut per tagli aggiuntivi orizzontali.
-- 2023/08/02 Corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo.
-- 2023/10/17 Corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative.
-- 2024/01/18 Gestita lama con aggregato con asse bloccato per massimizzare capacità di taglio verticale, se da sotto
-- Implementato split per pezzi molto alti con mix sega a catena + lama
-- Implementata GetBlockedAxis che gestisce gli assi bloccati per tutti i tipi di utensile.
-- Tabella per definizione modulo
local ProcessSplit = {}
@@ -23,6 +27,7 @@ local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw')
local Cut = require( 'ProcessCut')
local Pocket = require( 'FaceByPocket')
local Topology = require( 'FeatureTopology')
EgtOutLog( ' ProcessSplit started', 1)
@@ -193,7 +198,7 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
-- imposto uso del lato faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'perpendicular'))
local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT)
local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
@@ -223,7 +228,7 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sSawing, 'parallel'))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -240,12 +245,37 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
return true, sName, nMchFId
end
---------------------------------------------------------------------
-- tagli verticali aggiuntivi
local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw )
local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local nVerticalCuts = ceil( dimH / ( BD.MAX_DIM_DICE)) - 1
local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1)
-- recupero il diametro dell'utensile
local dSawDiam = 400
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
end
end
local bOk, sErr
-- tagli orizzontali
for j = nVerticalCuts, 1, -1 do
local nFaceUse = MCH_MILL_FU.PARAL_FRONT
local dVerticalCutOffset = dVerticalSliceHeight * -j
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw)
if not bOk then return bOk, sErr end
end
return bOk, sErr
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail)
-- impostazione default a variabili aggiunte
if not BD.OVM_CHAIN_HBEAM then BD.OVM_CHAIN_HBEAM = 8 end
if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = 180 end
if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = EgtIf( BD.C_SIMM, 180, 90) end
-- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId)
-- inserimento smussi
@@ -263,35 +293,35 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
end
-- recupero i dati dell'utensile
local dSawDiam = 400
local dMaxDepth = 50
local dSawMaxDepth = 50
local dSawThick = 2
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dSawMaxDepth = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth
dSawThick = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick
end
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
local dMaxVertDepth = dSawMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- recupero la eventuale lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
-- recupero i dati della eventuale seconda lama
local dSawDiam2 = 0
local dMaxDepth2 = 0
local dSawMaxDepth2 = 0
local dSawThick2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
dSawMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dSawMaxDepth2
dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2
end
end
-- caratteristiche taglio
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dSawMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dSawMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA))
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
@@ -306,6 +336,8 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
local dLenEndRaw = dOvmTail
local nCuts = 1
local dOffsL = 0
local _, dimH, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local dMinTailScrapForAdditionalCuts = 10.123
if not bSplit then
-- cerco grezzo successivo che sia nella fase
if nNextRawId and EgtVerifyRawPartPhase( nNextRawId, nPhase) then
@@ -322,56 +354,97 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
if bBigSectionCut then
local bFinishingNeeded = false
if bSplit then
-- recupero lunghezza massima di lavoro della sega a catena
-- recupero dati utensile della sega a catena più lunga a disposizione
local sSawing = ML.FindSawing( 'Sawing')
local dMaxMat = 0
local dTlen = 0
local dChainSawMaxMat = 0
local dChainSawLen = 0
if EgtMdbSetCurrMachining( sSawing or '') then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dTLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dTLen
dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat
dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen
end
end
local sSawing2 = ML.FindSawing( 'Sawing', dChainSawMaxMat + 1)
if sSawing2 then
sSawing = sSawing2
dChainSawMaxMat = 0
dChainSawLen = 0
if EgtMdbSetCurrMachining( sSawing or '') then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat
dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen
end
end
end
local bigSectionSplitType
-- se pezzo non troppo alto, taglio singolo da sopra
if b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dChainSawMaxMat + 10 * GEO.EPS_SMALL then
bigSectionSplitType = "single horizontal"
-- se pezzo non troppo largo, taglio singolo da davanti
elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
bigSectionSplitType = "single vertical"
-- se pezzo non troppo largo, tagli dai due fianchi (dietro e davanti)
elseif 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
bigSectionSplitType = "double vertical"
-- altrimenti taglio con sega a catena da sopra e con lama da sotto
elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dSawMaxDepth2 + dChainSawMaxMat + 10 * GEO.EPS_SMALL) then
bigSectionSplitType = "double horizontal"
end
-- assegno offset in lunghezza
local dOffs = 0
if dOvmTail > BD.OVM_CHAIN_HBEAM then
dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM
bFinishingNeeded = true
end
-- se pezzo non troppo alto, taglio singolo da sopra
if b3Raw:getDimZ() < dMaxMat - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL then
local cutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN
sNotesSplit = 'Split;'
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, cutDepth, sNotesSplit, dOffs)
-- in base alle scelte precedenti, applico le lavorazioni
if bigSectionSplitType == "single horizontal" then
local dCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN
local sNotesSplit = 'Split;'
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, dCutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
-- se pezzo non troppo largo, taglio singolo da davanti
elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
local cutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN
sNotesSplit = 'Split;'
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs)
elseif bigSectionSplitType == "single vertical" then
local dCutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN
local sNotesSplit = 'Split;'
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
-- altrimenti tagli dai due fianchi (dietro e davanti)
else
local cutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
-- se la sega a catena non può completare lo split esco
if cutDepth >= min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
sErr = 'Error : section too big for splitting'
EgtOutLog( sErr)
return false, sErr, -1
end
elseif bigSectionSplitType == "double vertical" then
local dCutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
local sNotesSplit = 'Presplit;'
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, cutDepth, sNotesSplit, dOffs)
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, dCutDepth, 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)
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
elseif bigSectionSplitType == "double horizontal" then
-- sega a catena da sopra
local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - dSawMaxDepth2
local sNotesSplit = 'Presplit;'
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
-- lama da sotto
local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
local sNotes = 'Split;'
local bMaximizeVerticalDepth = true
bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dOffs, 0, 0, sNotes, b3Raw, nil, bMaximizeVerticalDepth)
if not bOk then return false, sErr end
-- se è comunque troppo grande per essere separato, esco
else
local sErr = 'Error : section too big for splitting'
EgtOutLog( sErr)
return false, sErr, -1
end
-- se necessaria finitura, creo nuova fase
if bFinishingNeeded then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
nNewPhase = EgtGetCurrPhase()
nDispId = EgtGetPhaseDisposition( nNewPhase)
local nDispId = EgtGetPhaseDisposition( nNewPhase)
if sDownOrSideOrStd == 'down' then
EgtRotateRawPart( nRawId, X_AX(), 180)
EgtSetInfo( nDispId, 'TYPE', 'MID2')
@@ -414,10 +487,41 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX()
end
-- se finitura con lama
if nQ05 == 1 or nQ05 == 0 or ( not bSplit and dMaxElev > dSawThickCheck) then
if nQ05 < 2 or ( not bSplit and dMaxElev > dSawThickCheck) then
-- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard
if bSplit or dMaxElev > dSawThickCheck then
local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT)
local bOk, sErr
if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then
-- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti
for i = nCuts, 1, -1 do
local nAddGrpId = BL.GetAddGroup( Proc.PartId)
-- faccia di taglio all'offset corrente
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
local AddProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg, PartId = Proc.PartId}
Topology.Classify( AddProc, b3Raw)
local dCutOffset = ( i - 1) * dOffsL
local vtMoveSurf = Vector3d( -dCutOffset, 0, 0)
EgtMove( AddId, vtMoveSurf, GDB_RT.GLOB)
-- eventuale faccia di taglio all'offset precedente, per limitare il dicing e evitare di tagliare i cubetti nel vuoto
local nLimitingSurf
if nCuts > 1 then
nLimitingSurf = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
local dLastCutOffset = i * dOffsL
local vtMoveLimitingSurf = Vector3d( -dLastCutOffset + 10 * GEO.EPS_SMALL, 0, 0)
EgtMove( nLimitingSurf, vtMoveLimitingSurf, GDB_RT.GLOB)
local vtNLimitingSurf = EgtSurfTmFacetNormVersor( nLimitingSurf, 0)
if AreOppositeVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end
end
-- tagli verticali
bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw)
if not bOk then return bOk, sErr end
-- tagli a cubetti con eventuale superficie limitante
bOk, sErr = Cut.Make( AddProc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nLimitingSurf)
end
-- tagli aggiuntivi non necessari
else
bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT)
end
if sNotesFinal then
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
end
@@ -466,22 +570,30 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
else
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
dCutExtra = - ( b3Raw:getDimY() - dSawMaxDepth)
local dSawRad = dSawDiam / 2
-- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra
-- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave
local dKL = dSawRad - dMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
local dKL = dSawRad - dSawMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA)
-- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa
local dMinSawingLength = 5
if BD.C_SIMM then
dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata
if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength
end
else
dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0))
-- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita
if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then
dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength
end
end
end
-- per travi alte faccio faccio dei tagli orizzontali aggiuntivi
local _, _, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local dMinTailScrapForHorizontalCuts = 10.123
local bAreHorizontalCutsNeeded = not bSplit and ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForHorizontalCuts - 10 * GEO.EPS_SMALL)
local bAreHorizontalCutsNeeded = not bSplit and ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL)
if bAreHorizontalCutsNeeded then
local nHorizontalCuts = ceil ( dimV / BD.MAX_DIM_DICE) - 1
local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1)
@@ -524,6 +636,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
-- eseguo i tagli necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
-- se trave larga effettuo tagli verticali aggiuntivi
if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw)
if not bOk then return bOk, sErr end
end
local sNotes
if bSplit then
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
@@ -547,14 +664,14 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
end
-- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ()
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
local dExtra = dMaxVertDepth + dSawMaxDepth2 - dDimZ
if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not bBigSectionCut then
local sErr = 'Error : section too big for tail cut'
EgtOutLog( sErr)
return false, sErr
end
-- calcolo extra taglio ed accorciamento
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra = -dSawMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0
-- limiti da sotto
@@ -564,12 +681,17 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw, nil, true)
if not bOk then return false, sErr end
end
-- eseguo i tagli da sopra necessari
for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL
-- se trave larga effettuo tagli verticali aggiuntivi
if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then
local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw)
if not bOk then return bOk, sErr end
end
local sNotes
if bSplit then
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
+9 -2
View File
@@ -1,4 +1,4 @@
-- ProcessTenon.lua by Egaltech s.r.l. 2023/03/27
-- ProcessTenon.lua by Egaltech s.r.l. 2023/09/26
-- 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.
@@ -10,6 +10,7 @@
-- 2022/12/20 Aggiunta gestione smusso. Migliorata scelta tra sopra e sotto per il punto di inizio. In VerifyOrientation aggiunta trave medio alta.
-- 2023/01/20 Modificata scelta lato di attacco per pezzo piccolo su macchine con pinza speciale (pinza 5).
-- 2023/03/27 Migliorate condizioni scelta pretaglio con lama o fresa; gestione unificata con ProcessDtTenon. Migliorato calcolo altezza tenone.
-- 2023/09/26 Per macchina TURN si assegna SCC per privilegiare accesso dal lato corto della trave.
-- Tabella per definizione modulo
local ProcessTenon = {}
@@ -325,7 +326,13 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM and not BD.TURN then
if BD.TURN then
if b3Solid:getDimY() >= b3Solid:getDimZ() then
nSCC = MCH_SCC.ADIR_ZP
else
nSCC = MCH_SCC.ADIR_YM
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)
+3 -2
View File
@@ -1,6 +1,7 @@
-- 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)
-- 2023/09/26 Modificata chiamata a GetFaceWithMostAdj.
-- Tabella per definizione modulo
local ProcessTyroleanDovetail = {}
@@ -510,10 +511,10 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
dStepmach = dMaxMat * 0.5
end
-- recupero la faccia con il maggior numero di adiacenze e l'elevazione relativa
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, sin(dSideAngle))
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, sin(dSideAngle))
if not nFacInd or nFacInd < 0 then
-- provo eliminando i sottosquadra
nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false, -2)
nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc, nPartId, false, -2)
if not nFacInd or nFacInd < 0 then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' MakeMachByMill could not find reference face'
EgtOutLog( sErr)
+170
View File
@@ -0,0 +1,170 @@
-- ProcessVariant.lua by Egaltech s.r.l. 2023/11/08
-- Gestione calcolo Feature Custom (Variant) per Travi
-- 2023/11/08 Creazione modulo.
-- 2023/11/30 Calcolo elevazione velocizzato e centralizzato tramite la funzione GetFaceElevation.
-- Tabella per definizione modulo
local ProcessVariant = {}
-- Include
require( 'EgtBase')
local BL = require( 'BeamLib')
EgtOutLog( ' ProcessVariant started', 1)
-- Dati
local BD = require( 'BeamData')
local ML = require( 'MachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function ProcessVariant.Identify( Proc)
return (( Proc.Grp == 0 or Proc.Grp == 1 or Proc.Grp == 2 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 900)
end
---------------------------------------------------------------------
-- Classificazione della feature: decide se la feature è in una posizione lavorabile
local function ClassifyPocket( Proc, b3Raw)
-- recupero gli indici delle facce da lavorare
local vFace = EgtGetInfo( Proc.Id, 'Faces', 'vi')
if not vFace or #vFace == 0 then
local sErr = 'Error : missing Faces for Pocketing'
EgtOutLog( sErr)
return false
end
-- recupero le normali di tutte le facce e verifico siano uguali
local vtN
for i = 1, #vFace do
local vtNf = EgtSurfTmFacetNormVersor( Proc.Id, vFace[i], GDB_ID.ROOT)
if not vtN then
vtN = vtNf
else
if not AreSameVectorApprox( vtN, vtNf) then
local sErr = 'Error : Faces for Pocketing with different orientation'
EgtOutLog( sErr)
return false
end
end
end
local bDown = ( vtN:getZ() < - 0.5)
-- se da sotto e presente rinvio angolare verifico se c'è opportuna lavorazione
if bDown and BD.ANG_TRASM then
local dMaxDiam = EgtGetInfo( Proc.Id, 'MaxDiam', 'd')
if ML.FindPocketing( 'Pocket_AT', dMaxDiam) then
bDown = false
end
end
return true, bDown, false
end
---------------------------------------------------------------------
function ProcessVariant.Classify( Proc, b3Raw)
-- recupero il codice identificativo e il tipo di lavorazione
local sCode = EgtGetInfo( Proc.Id, 'DES')
local sType = EgtGetInfo( Proc.Id, 'Type')
-- gestione in base al tipo
if sType == 'Pocket' then
return ClassifyPocket( Proc, b3Raw)
else
return false
end
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
local function MakePocket( Proc, nRawId, b3Raw, nPartId)
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- recupero gli indici delle facce da lavorare
local vFace = EgtGetInfo( Proc.Id, 'Faces', 'vi')
if not vFace or #vFace == 0 then
local sErr = 'Error : missing Faces for Pocketing'
EgtOutLog( sErr)
return false
end
-- recupero i dati delle facce (le normali sono identiche)
local dTotDepth = 0
local vDepth = {}
for i = 1, #vFace do
vDepth[i] = BL.GetFaceElevation( Proc, vFace[1], b3Solid)
dTotDepth = max( dTotDepth, vDepth[i])
end
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, vFace[1], GDB_ID.ROOT)
-- recupero eventuale massimo diametro impostato
local dMaxDiam = EgtGetInfo( Proc.Id, 'MaxDiam', 'd')
-- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtN:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.174)
local bMillAngTrasm = ( BD.ANG_TRASM and vtN:getZ() < -0.5)
-- recupero la lavorazione
local sPockType = EgtIf( not bMillAngTrasm, 'Pocket', 'Pocket_AT')
local sPocketing = ML.FindPocketing( sPockType, dMaxDiam, dTotDepth)
if not sPocketing then
sPocketing = ML.FindPocketing( sPockType, dMaxDiam, dTotDepth / 2)
if not sPocketing then
local sErr = 'Error : pocketing not found in library'
EgtOutLog( sErr)
return false, sErr
end
end
-- recupero i dati dell'utensile
local dMillDiam = 20
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- se elevazione superiore a massimo affondamento della fresa, segnalo
local sWarn
if dTotDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- lavoro ogni faccia
for i = 1, #vFace do
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i)
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, vFace[i]}})
-- imposto posizione braccio porta testa
if vtN:getY() <= 0 then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
EgtSetMachiningParam( MCH_MP.DEPTH, min( 0, dMaxDepth - vDepth[i]))
-- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxDepth, 1) .. ';')
-- eseguo
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
return true, sWarn
end
---------------------------------------------------------------------
function ProcessVariant.Make( Proc, nRawId, b3Raw, nPartId)
-- recupero il codice identificativo e il tipo di lavorazione
local sCode = EgtGetInfo( Proc.Id, 'DES')
local sType = EgtGetInfo( Proc.Id, 'Type')
-- gestione in base al tipo
if sType == 'Pocket' then
return MakePocket( Proc, nRawId, b3Raw, nPartId)
else
return false, 'Variant Type non recognized for machining'
end
end
---------------------------------------------------------------------
return ProcessVariant
+23 -19
View File
@@ -115,23 +115,6 @@ local function MyProcessInputData()
end
EgtDeselectAll()
-- Le ordino in senso di lunghezza crescente
table.sort( vBeam, function( B1, B2)
if abs( B1.Box:getDimX() - B2.Box:getDimX()) < 1 then
return B1.Ind < B2.Ind
else
return B1.Box:getDimX() < B2.Box:getDimX()
end
end)
do
local sOut = ''
for i = 1, #vBeam do
sOut = sOut .. vBeam[i].Name .. ', '
end
sOut = sOut:sub( 1, -3)
EgtOutLog( 'Travi ordinate : ' .. sOut, 1)
end
return true
end
@@ -152,12 +135,13 @@ local function MyProcessBeams()
local dAddLen = BD.OVM_HEAD + ( #vBeam - 1) * BD.OVM_MID
EgtOutLog( 'Ltot : '..EgtNumToString( dTotLen, 1) .. ' Lagg : '..EgtNumToString( dAddLen, 1)..' MinUnloadRaw : '.. EgtNumToString( BD.MinRaw + BD.OVM_MID, 1), 1)
-- Richiedo lunghezza del grezzo e sovramateriale di testa
-- Richiedo lunghezza del grezzo, sovramateriale di testa, forzatura verticale e ordinamento automatico secondo la lunghezza
local vsVal = EgtDialogBox( 'Lavora Travi' .. ' (Ltot='..EgtNumToString( dTotLen + dAddLen + 0.5, 0)..
', Lmax='..EgtNumToString( BD.MAX_RAW, 0)..',MinUlr='..EgtNumToString( BD.MinRaw + BD.OVM_MID, 0)..')',
{'Lunghezza grezzo', EgtNumToString( BD.STD_RAW, 0)},
{'Sovramateriale di testa', EgtNumToString( BD.OVM_HEAD, 0)},
{'Forza sezione verticale', ' CB:true,*false'})
{'Forza sezione verticale', ' CB:true,*false'},
{'Ordina per lunghezza', ' CB:true,*false'})
if not vsVal then
EgtDraw()
return
@@ -221,6 +205,26 @@ local function MyProcessBeams()
return false
end
-- Se richiesto, ordino le travi in senso di lunghezza crescente
local bOrd = ( vsVal[4] == 'true')
if bOrd then
table.sort( vBeam, function( B1, B2)
if abs( B1.Box:getDimX() - B2.Box:getDimX()) < 1 then
return B1.Ind < B2.Ind
else
return B1.Box:getDimX() < B2.Box:getDimX()
end
end)
end
do
local sOut = ''
for i = 1, #vBeam do
sOut = sOut .. vBeam[i].Name .. ', '
end
sOut = sOut:sub( 1, -3)
EgtOutLog( 'Travi ordinate : ' .. sOut, 1)
end
-- Sistemo le travi nel grezzo
local bOk, sErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam)
if not bOk then
+53
View File
@@ -1,5 +1,58 @@
==== Beam Update Log ====
Versione 2.5l3 (08/01/2023)
- Modif : modifiche per centrare i pezzi in Y sulla tavola (da flag BeamData.CENTER_BEAM)
- Modif : resi più veloci i calcoli di FeatureTopology
- Modif : migliorato calcolo attacco/uscite lame in FacesBySaw.
Versione 2.5l2 (20/12/2023)
- Modif : in Cut e DoubleCut modifica in scelta ribaltamento trave quando si è in condizioni downUp
- Modif : migliorato e esteso il funzionamento di SideMillAsSaw
- Modif : in LapJoint con più facce, nelle OpenPocket, ammesso utensile con diametro fino a 3 volte la dimensione della tasca (era 2)
- Modif : in RoundArch aggiunta gestione senso di rotazione fresa per lavorare sempre in concordanza
- Fixed : correzione a GetFaceWithMostAdj per calcoli con facce che fanno ombra
Versione 2.5l1 (01/12/2023)
- Added : in LongDoubleCut aggiunta Q05 per utilizzo lama anche in feature cieche conme per LongCut
- Modif : Migliorato e velocizzato il calcolo elevazione (EgtSurfTmFacetElevationInBBox)
- Fixed : in MakeTwo di FacesBySaw raffinamento calcolo vtRef per casi dubbi.
Versione 2.5k3 (28/11/2023)
- Added : in Long2Cut gestite lavorazioni lama con Q05 come in LongCut.
Versione 2.5k2 (06/11/2023)
- Added : in LapJoint, per L020, gestita lavorazione speciale gradino scala con fresatura + lama, attivata con Q09
- Fixed : in ProcessSplit si imposta l'ingombro asse C correttamente anche per teste con asse rotante C con un solo braccio.
Versione 2.5k1 (02/11/2023)
- Modif : in LapJoint gestito caso groove due facce >90° con fresa, se forzato da parametro Q
- Modif : in LongCut e LongDoubleCut migliorata spezzatura taglio passante con due spezzoni
- Modif : nei tagli di lama migliorata gestione con percorso bilinea
- Modif : in LapJoint 2 facce longitudinali si usa taglio di lama solo se si taglia completamente, altrimenti fresa.
Versione 2.5j1 (23/10/2023)
- Added : in Process (lancio da EgtCAM5 quindi uso praticamente solo interno) aggiunta possibilità di tenere ordine pezzi in barra come da selezione
- Modif : in Topology aggiunti casi al check solo direzione principale
- Modif : nella ricerca lavorazione da usare controllo di utensile attivo sostituito con controllo utensile presente nel setup corrente
- Fixed : piccola correzione a Classify di FeatureTopology per casi senza geometria
- Fixed : in HeadCut e Split corretto calcolo allungamenti/accorciamenti per evitare lunghezze del percorso negative
- Fixed : in Lapjoint -> MakePocket aggiunto messaggio in caso si rovini il pezzo successivo.
Versione 2.5i2 (27/09/2023)
- Added : aggiunto riconoscimento sottosquadro da facce non adiacenti
- Modif : in lavorazione tenoni per Turn si assegna SCC per privilegiare accesso dal lato corto della trave.
- Fixed : in LapJoint corretto caso tunnel lungo non lavorato correttamente
- Fixed : in foratura quando errore in applicazione lavorazione si inverte e riprova solo se singola su foro aperto
Versione 2.5i1 (12/09/2023)
- Modif : in Cut abbassato a 590 mm il limite per convertire in LongCut [Ticket #1448]
- Fixed : in LapJoint gestito correttamente il ritorno nil di GetUShapeWidth [Ticket #1354].
Versione 2.5h2 (11/08/2023)
- Modif : in LapJoint e Mortise modificata posizione braccio per FAST quando vicino alla coda della trave
- Fixed : corrette forature con aggregato quando lato aperto
- Fixed : in RidgeLap corretto ingombro lavorazione in testa e coda quando rivolta verso il basso.
Versione 2.5h1 (07/08/2023)
- Fixed : tagli doppi di lato non effettuati se macchina tipo PF e pezzo alto [Ticket #1400]
- Fixed : in split e headcut corretto calcolo allungamenti/accorciamenti pezzi alti per contemplare anche taglio singolo [Ticket #1227]
+3 -3
View File
@@ -1,6 +1,6 @@
-- Version.lua by Egaltech s.r.l. 2023/08/01
-- Version.lua by Egaltech s.r.l. 2024/01/08
-- Gestione della versione di Beam
NAME = 'Beam'
VERSION = '2.5h1'
MIN_EXE = '2.5c1'
VERSION = '2.5l3'
MIN_EXE = '2.5l3'