Compare commits

..

125 Commits

Author SHA1 Message Date
Dario Sassi e15a833158 DataWall 2.7g2 :
- aggiunta gestione origine e offset da questa che non fanno riprocessare l'intero grezzo (ma solo aggiornare)
- corretta BatchProcess per nome file anche se da non riprocessare.
2025-07-17 17:24:09 +02:00
luca.mazzoleni 8f36025b64 Merge branch 'release/2.7g1' 2025-07-09 13:07:28 +02:00
luca.mazzoleni 0bec7ba4a5 - update version e log 2025-07-09 13:07:07 +02:00
luca.mazzoleni 95346a26d7 - correzione a FreeContour.GetEdgeToMachineFromVector 2025-07-04 09:46:23 +02:00
luca.mazzoleni e59ca27cdf update versione minima 2025-06-26 12:44:21 +02:00
luca.mazzoleni 10c44c7f82 - in FreeContour si usa EdgesFaceUse per scegliere con più precisione in lato; manca gestione completa in caso di lavorazione con geometrie multiple (al momento si può passare un lato solo) 2025-06-26 11:17:00 +02:00
luca.mazzoleni b2adfc098b Merge tag '2.7f2' into develop
2.7f2
2025-06-06 11:04:01 +02:00
luca.mazzoleni ec1eddf909 Merge branch 'release/2.7f2' 2025-06-06 11:03:53 +02:00
luca.mazzoleni dfeb8c38dd update vresion e log 2025-06-06 11:03:43 +02:00
luca.mazzoleni a6b72d13cd - in LapJoint migliorie a svuotature 2025-06-06 11:02:09 +02:00
luca.mazzoleni c58a9e7912 Merge tag '2.7f1' into develop
2.7f1
2025-06-05 10:26:25 +02:00
luca.mazzoleni a13dcbccf9 Merge branch 'release/2.7f1' 2025-06-05 10:26:17 +02:00
luca.mazzoleni 437682ab7a update version e log 2025-06-05 10:25:44 +02:00
andrea.villa a7d6363228 In BatchProcess, anche se non è da riprocessare, si setta come nota sul MachGroup il nome del codice CNC da utilizzare 2025-05-05 08:06:48 +02:00
luca.mazzoleni b452a9ad99 - modifiche a DoubleCut per contemplare più casi 2025-04-29 15:06:00 +02:00
luca.mazzoleni 4fc7110885 - per cabinet, gestita forzatura freecontour di fresa per macchine senza lama (costante WallData FORCE_MILL_CONTOUR) 2025-04-22 16:27:52 +02:00
luca.mazzoleni f07e0d4afd Merge tag '2.7d1' into develop
2.7d1
2025-04-14 15:17:01 +02:00
luca.mazzoleni 29c1eaed0c Merge branch 'release/2.7d1' 2025-04-14 15:16:55 +02:00
luca.mazzoleni 6cf29a3a06 update log e version 2025-04-14 15:16:01 +02:00
luca.mazzoleni 0f84937c6f - in LapJoint.ClassifyFlip correzione per caso con 4 facce 2025-04-10 14:22:30 +02:00
luca.mazzoleni d8af5b3989 update log 2025-03-21 15:15:45 +01:00
luca.mazzoleni b8ee911ed5 - in WProcessLapJoint.MakeTwoFaces prevista (al momento solo doublecut) Q06 per forzare lama 2025-03-21 15:14:11 +01:00
luca.mazzoleni 95006f4cce Merge tag '2.7b1' into develop
2.7b1
2025-03-03 09:35:31 +01:00
luca.mazzoleni 0b78227c6b Merge branch 'release/2.7b1' 2025-03-03 09:35:21 +01:00
luca.mazzoleni b6dd9a096a - update log e version 2025-03-03 09:34:59 +01:00
luca.mazzoleni 2b67b00d2e Merge branch 'feature/MultiDrillForCabinet' into develop 2025-03-03 09:32:27 +01:00
luca.mazzoleni f434c70f22 - correzioni a forature multiple 2025-02-14 17:24:16 +01:00
luca.mazzoleni 221162ce9d correzione in forature 2025-02-14 11:10:31 +01:00
luca.mazzoleni f48b40d633 - correzioni a MultiDrill 2025-02-13 15:06:48 +01:00
luca.mazzoleni 0388dbdc0f - in MultiDrill piccole correzioni 2025-02-12 11:19:23 +01:00
luca.mazzoleni a27566031b - modifiche varie per gestione MultiDrill, al momento per Cabinet 2025-02-11 18:46:10 +01:00
luca.mazzoleni 36ddc182f9 Merge tag '2.7a2' into develop
2.7a2
2025-01-23 10:43:32 +01:00
luca.mazzoleni cb473692dd Merge branch 'release/2.7a2' 2025-01-23 10:43:22 +01:00
luca.mazzoleni 3e805545f0 update version 2025-01-23 10:43:09 +01:00
luca.mazzoleni 611ab1cb12 update log 2025-01-23 10:42:43 +01:00
luca.mazzoleni 6fda7f818f - in BatchProcess UpdateAuxData corretto un problema che portava a rotazioni errate dei pezzi in vista Ts7
- Correzioni a squadratura
2025-01-23 10:40:23 +01:00
luca.mazzoleni d4c94d9e8a Merge tag '2.7a1' into develop
2.7a1
2025-01-21 09:58:19 +01:00
luca.mazzoleni 612b73e2e9 Merge branch 'release/2.7a1' 2025-01-21 09:58:11 +01:00
luca.mazzoleni d82802bd10 update version e log 2025-01-21 09:54:00 +01:00
luca.mazzoleni 00d5f929bb - in BatchProcess (Ts7) aggiunta scrittura id progetto e produzione in Btm 2025-01-21 09:52:29 +01:00
luca.mazzoleni 8c30535a69 Merge tag '2.6l1' into develop
2.6l1
2024-12-11 14:36:20 +01:00
luca.mazzoleni 5d5eb3f5cc Merge branch 'release/2.6l1' 2024-12-11 14:35:59 +01:00
luca.mazzoleni e3faec9d5d - update log e version 2024-12-11 14:35:12 +01:00
luca.mazzoleni e844d761f9 - in LapJoint -> CalcInterference ora si usano le stesse funzioni della FreeContour 2024-12-02 18:11:47 +01:00
luca.mazzoleni 6a86f7798e - in FreeContour eLapJoint ->CleanCorner si scrivono ora TASKID e CUTID per riportare le collisioni sulla feature specifica 2024-12-02 11:47:48 +01:00
luca.mazzoleni 6a6a194df6 - in LapJoint modifica al calcolo feature passante per gorge 2024-11-29 17:52:11 +01:00
luca.mazzoleni dcd600af01 - in LapJoint correzioni varie 2024-11-29 17:21:17 +01:00
luca.mazzoleni 854fafddf2 Merge tag '2.6k3' into develop
2.6k3
2024-11-27 17:45:13 +01:00
luca.mazzoleni ef6cbc35df Merge branch 'hotfix/2.6k3' 2024-11-27 17:44:49 +01:00
luca.mazzoleni 2887591da4 update version e log 2024-11-27 17:44:41 +01:00
luca.mazzoleni 3d75344652 Merge branch 'develop' into hotfix/2.6k2 2024-11-27 17:42:25 +01:00
luca.mazzoleni 1952c937b0 - in LapJoint -> MakeSideGrooveByMill corretto e modificato calcolo leadin/out perpendicolare 2024-11-27 17:41:23 +01:00
luca.mazzoleni 99baaa6320 Merge tag 'NestingSilhouetteTolerance' into develop
2.6k2
2024-11-19 12:20:13 +01:00
luca.mazzoleni 3ac752861b Merge branch 'hotfix/NestingSilhouetteTolerance' 2024-11-19 12:19:52 +01:00
luca.mazzoleni d690906180 - in NestProcess tolleranza silhouette riportata al valore pre modifiche DLL 2024-11-19 12:19:27 +01:00
luca.mazzoleni 1bf70aaf27 Merge branch 'master' into develop 2024-11-15 18:12:01 +01:00
luca.mazzoleni e5a2a7e5a9 - modificato compile per contemplare Squaring.lua 2024-11-15 18:05:38 +01:00
luca.mazzoleni b726fbc2cc Merge tag '2.6k1' into develop
2.6k1
2024-11-14 15:22:29 +01:00
luca.mazzoleni 0771665282 Merge branch 'release/2.6k1' 2024-11-14 15:21:43 +01:00
luca.mazzoleni 6ba42d19e9 update version e log 2024-11-14 15:21:12 +01:00
luca.mazzoleni 374021ad13 - in NestProcess corretta creazione outline che in precedenza funzionava (modificata la gestione tolleranza nella funzione EgtGetSurfTmSilhouette con aggiornamenti DLL recenti) 2024-11-14 14:49:36 +01:00
luca.mazzoleni dfe405f3b0 - in NestProcess corretta indentazione 2024-11-13 17:17:12 +01:00
andrea.villa bd7885d245 Se feature taglio, si controlla solo interferenza altri pezzi e non lunghezza minima 2024-11-08 12:32:31 +01:00
luca.mazzoleni 1c19c48e55 Merge branch 'SquaringMasterPanel' into develop 2024-11-04 16:57:12 +01:00
luca.mazzoleni 9a40887d05 Merge branch 'develop' into SquaringMasterPanel 2024-11-04 15:40:23 +01:00
luca.mazzoleni 02e1bc7881 Merge branch 'master' into develop 2024-11-04 15:40:12 +01:00
luca.mazzoleni 5791bea4b5 in Squaring modifiche a lettura parametri utensili 2024-11-04 15:35:15 +01:00
andrea.villa 5b39d1a4ac Update Version 2024-11-04 15:23:04 +01:00
andrea.villa 62e00e8854 Update Version e Log 2024-11-04 15:22:35 +01:00
andrea.villa 349f0cb879 Merge branch 'hotfix/SideGrooveBladeLimitWidth' 2024-11-04 15:19:12 +01:00
andrea.villa a53a6f3e63 Modificato limite dimensione tasca per utilizzo lama come SideGroove 2024-11-04 15:18:45 +01:00
luca.mazzoleni 4f2ffec3ab - in Squaring migliorie varie
- aggiunta rimozione lavorazioni fuori dall'area di squadratura
- in WallExec squadratura suddivisa prima e dopo le altre lavorazioni
- in FreeContour aggiunta funzione IsFaceOutsideSquaring per evitare di lavorare le facce che finiscono fuori dall'area di squadratura
2024-10-31 16:04:15 +01:00
luca.mazzoleni b1dd887899 - in Squaring implementata modalità ShrinkToParts; manca la rimozione delle lavorazioni fuori dall'area squadrata 2024-10-29 17:38:31 +01:00
luca.mazzoleni b325ebcd32 - in MachiningLib aggiunta funzione GetMachiningSteps per il calcolo degli stepdi lavorazione
- in Squaring aggiunti step verticali con lavorazioni aggiuntive
- in WallExec gestito default per parametro di squadratura TOOL
2024-10-29 13:14:00 +01:00
luca.mazzoleni f17411326b Merge branch 'develop' into SquaringMasterPanel 2024-10-29 09:17:58 +01:00
luca.mazzoleni 4752ffcfb4 Merge tag '2.6j1' into develop
release
2024-10-29 09:16:42 +01:00
luca.mazzoleni dbf17d942c Merge branch 'release/2.6j1' 2024-10-29 09:16:33 +01:00
luca.mazzoleni 72020a8874 update version e log 2024-10-29 09:16:24 +01:00
luca.mazzoleni 5d422b6edc - in NestProcess corretta rotazione in caso di flip deciso da nesting 2024-10-29 09:10:57 +01:00
luca.mazzoleni d2b3c32b61 - in Squaring aggiunt creazione lavorazione al momento e settaggio parametri
- in Squaring gestito allungamento e attacco verticale per contemplare overmaterial e altezza pezzo
2024-10-29 09:09:19 +01:00
luca.mazzoleni b4b3df0f5e - in Squaring modifiche a GetTools e CreateGeometry per contemplare tutti i casi specifici 2024-10-23 12:13:39 +02:00
luca.mazzoleni fdd114a8cd - in WallExec -> squadratura aggiunta funzione AddSquaring che verifica e aggiunge la squadratura in base al caso specifico
- in Squaring aggiunte funzioni per ricerca e controllo correttezza utensili in base al caso specifico
2024-10-21 12:43:28 +02:00
luca.mazzoleni d5e47c06fa Merge branch 'develop' into SquaringMasterPanel 2024-10-16 17:22:58 +02:00
luca.mazzoleni abc61f53ba - in nesting e flipRotate correzioni a rotazione pezzi 2024-10-16 17:01:45 +02:00
luca.mazzoleni 6e7c4ffda1 - modifiche parziali a squadratura per contemplare casi in doppio 2024-10-16 16:59:17 +02:00
luca.mazzoleni bfaa85bbf2 - in squadratura aggiunta gestione truciolatore e ritorno errori 2024-10-14 14:26:58 +02:00
luca.mazzoleni 5c9e199c5a - in squadratura aggiunta gestione della direzione di percorrenza delle geometrie in base a rotazione utensile e riferimento; altri miglioramenti 2024-10-11 11:36:24 +02:00
luca.mazzoleni 09127ce576 - in WallExec aggiunta squadratura, da completare 2024-10-09 18:09:02 +02:00
luca.mazzoleni 87cd31bef7 Merge branch 'develop' into SquaringMasterPanel 2024-09-30 12:38:22 +02:00
luca.mazzoleni 32fdaf5096 Merge tag '2.6i2' into develop
release
2024-09-30 12:29:49 +02:00
luca.mazzoleni 2ea09e3ebc Merge branch 'release/2.6i2' 2024-09-30 12:29:34 +02:00
luca.mazzoleni ce8072ad1b update version e log 2024-09-30 12:29:23 +02:00
luca.mazzoleni 896c0296a4 Merge branch 'develop' into SquaringMasterPanel 2024-09-25 12:35:10 +02:00
luca.mazzoleni 88fd8d525c Merge branch 'master' into develop 2024-09-25 12:34:57 +02:00
luca.mazzoleni 01c5037d77 update version e log 2024-09-25 12:33:03 +02:00
luca.mazzoleni 34e7befc10 Merge remote-tracking branch 'origin/master' into develop 2024-09-10 15:13:35 +02:00
Emmanuele Sassi 846d96b967 - correzione in lettura array per cambio dll di lettura 2024-09-10 09:09:51 +02:00
luca.mazzoleni cfd3379c98 Merge branch 'develop' of https://gitlab.steamware.net/egaltech/DataWall into develop 2024-09-02 10:52:47 +02:00
andrea.villa 6f06755539 Aggiunta nota altezza sottopezzo, per pareti a layer 2024-08-30 09:13:33 +02:00
andrea.villa a0af959c9f Merge remote-tracking branch 'origin/master' into develop 2024-08-30 09:13:20 +02:00
luca.mazzoleni f397b66e26 Merge branch 'master' into develop 2024-08-28 10:12:53 +02:00
luca.mazzoleni 31782b904e Merge commit '93fe741f8439bf0abf51c0ab2e086e07fc77a58d' 2024-08-28 10:11:38 +02:00
luca.mazzoleni 93fe741f84 update log e version 2024-08-28 10:11:26 +02:00
luca.mazzoleni ba2158a909 - in FreeContour corretto caso in cui si chiedevano informazioni sulla faccia non presenti 2024-08-28 10:09:40 +02:00
Dario Sassi 6e0758218c Aggiunto controllo licenza/chiave per abilitazione generazione PartProgram. 2024-08-21 11:52:59 +02:00
luca.mazzoleni 401108ce56 Merge branch 'master' into develop 2024-08-20 16:53:05 +02:00
luca.mazzoleni b7973541e4 update log 2024-08-20 16:52:11 +02:00
Dario Sassi bf1e9065ae Wall 2.6h1 :
- aggiunti nuovi parametri alla chiamata della funzione GetChainSawStartAngs da WallData della macchina.
2024-08-20 14:43:45 +02:00
luca.mazzoleni 1faa9e2075 Merge branch 'master' into develop 2024-08-19 16:11:51 +02:00
Dario Sassi ceef5b78f3 Merge commit '66e2bd6e45d6990a8b30ecf39791437618ca85cd' 2024-08-19 15:04:00 +02:00
luca.mazzoleni 66e2bd6e45 - in Collect analisi facce limitata a feature che ne hanno meno di 50 2024-08-09 12:40:59 +02:00
andrea.villa 0508f12673 In ProcessLapJoint, se fresa Side trovata ma non applicabile, si considera come se non trovata 2024-08-09 11:46:43 +02:00
luca.mazzoleni 2bbfe1f3ce Merge branch 'master' into develop 2024-07-19 18:13:35 +02:00
luca.mazzoleni 4a67fdeeff Merge branch 'develop' 2024-07-19 18:13:18 +02:00
luca.mazzoleni 1c86ed925a in BatchProcess e BatchProcessNew bToRecalc forzato se flag 3 o 4 2024-07-19 18:13:07 +02:00
luca.mazzoleni 3f8540b3df Merge tag '2.6g1' into develop
i
2024-07-17 15:51:11 +02:00
luca.mazzoleni c92327641c Merge branch 'release/2.6g1' 2024-07-17 15:50:55 +02:00
luca.mazzoleni 499e49f4f6 - update log e version
- piccola modifica in ProcessDrill
2024-07-17 15:50:41 +02:00
luca.mazzoleni 099e81cbfd - in ProcessDrill aggiunti, se foro verticale passante, riduzione affondamento di 5 mm sostituito con tab.
Attualmente limite dal diametro di 200 mm, da verificare
2024-07-17 11:25:17 +02:00
luca.mazzoleni 0f38de8f58 Merge branch 'DefaultRawNoExtraWidth' into develop 2024-06-27 16:39:42 +02:00
luca.mazzoleni d5e30baf06 - ulteriori correzioni per DEFAULT_RAW_NO_EXTRA_WIDTH 2024-06-27 16:38:45 +02:00
luca.mazzoleni 4531434e79 - correzioni a DEFAULT_RAW_NO_EXTRA_WIDTH 2024-06-27 15:50:24 +02:00
luca.mazzoleni e56074f662 modifiche ulteriori per parametro DEFAULT_RAW_NO_EXTRA_WIDTH 2024-06-27 14:56:37 +02:00
luca.mazzoleni 5866566ebe - in BatchProcess, in caso di DEFAULT_RAW_NO_EXTRA_WIDTH, azzerati eventuali PosX e PosZ in arrivo sul pezzo 2024-06-24 09:57:21 +02:00
luca.mazzoleni c4272d917e Merge tag '2.6f1' into develop
a
2024-06-21 12:23:02 +02:00
14 changed files with 1538 additions and 432 deletions
+62 -6
View File
@@ -1,4 +1,4 @@
-- BatchProcess.lua by Egaltech s.r.l. 2023/04/17 -- BatchProcess.lua by Egaltech s.r.l. 2025/07/17
-- Gestione calcolo batch disposizione e lavorazioni per Pareti -- Gestione calcolo batch disposizione e lavorazioni per Pareti
-- 2020/07/24 Nuvola di punti riferita allo Zero Tavola. -- 2020/07/24 Nuvola di punti riferita allo Zero Tavola.
-- 2020/10/28 Corretto spostamento pezzi per rotazioni (0 o 180) e inversioni( 0, 90, 180, o 270). -- 2020/10/28 Corretto spostamento pezzi per rotazioni (0 o 180) e inversioni( 0, 90, 180, o 270).
@@ -92,13 +92,49 @@ end
-- Funzione per aggiornare dati ausiliari -- Funzione per aggiornare dati ausiliari
local function UpdateAuxData( sAuxFile) local function UpdateAuxData( sAuxFile)
local bModif = false local bModif = false
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
-- Se definito PROJID, aggiorno
local sProjId = EgtGetStringFromIni( 'AuxData', 'PROJID', '', sAuxFile)
if sProjId ~= '' then
EgtSetInfo( BtlInfoId, 'PROJECTNUMBER', sProjId)
bModif = true
end
-- Se definito PRODID, aggiorno
local sProdId = EgtGetStringFromIni( 'AuxData', 'PRODID', '', sAuxFile)
if sProdId ~= '' then
EgtSetInfo( BtlInfoId, 'PRODID', sProdId)
bModif = true
end
-- Se definito LOAD90, aggiorno -- Se definito LOAD90, aggiorno
local sLoad90 = EgtGetStringFromIni( 'AuxData', 'LOAD90', '', sAuxFile) local sLoad90 = EgtGetStringFromIni( 'AuxData', 'LOAD90', '', sAuxFile)
if sLoad90 ~= '' then if sLoad90 ~= '' then
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
EgtSetInfo( BtlInfoId, 'LOAD90', sLoad90) EgtSetInfo( BtlInfoId, 'LOAD90', sLoad90)
bModif = true bModif = true
end end
-- Se definito REFPOS, aggiorno
local sRefPos = EgtGetStringFromIni( 'AuxData', 'REFPOS', '', sAuxFile)
if sRefPos ~= '' then
EgtSetInfo( BtlInfoId, 'REFPOS', sRefPos)
bModif = true
end
-- Se definito PANELDELTAX, aggiorno
local sPanelDeltaX = EgtGetStringFromIni( 'AuxData', 'PANELDELTAX', '', sAuxFile)
if sPanelDeltaX ~= '' then
EgtSetInfo( BtlInfoId, 'PANELDELTAX', sPanelDeltaX)
bModif = true
end
-- Se definito PANELDELTAY, aggiorno
local sPanelDeltaY = EgtGetStringFromIni( 'AuxData', 'PANELDELTAY', '', sAuxFile)
if sPanelDeltaY ~= '' then
EgtSetInfo( BtlInfoId, 'PANELDELTAY', sPanelDeltaY)
bModif = true
end
-- Se definito PANELDELTAZ, aggiorno
local sPanelDeltaZ = EgtGetStringFromIni( 'AuxData', 'PANELDELTAZ', '', sAuxFile)
if sPanelDeltaZ ~= '' then
EgtSetInfo( BtlInfoId, 'PANELDELTAZ', sPanelDeltaZ)
bModif = true
end
return bModif return bModif
end end
@@ -139,7 +175,6 @@ end
-- Carico le librerie -- Carico le librerie
_G.package.loaded.WallExec = nil _G.package.loaded.WallExec = nil
local WE = require( 'WallExec') local WE = require( 'WallExec')
--local BL = require( 'BeamLib')
-- Carico i dati globali -- Carico i dati globali
local WD = require( 'WallData') local WD = require( 'WallData')
@@ -280,6 +315,11 @@ if bToProcess then
-- Ne recupero la posizione -- Ne recupero la posizione
for i = 1, #vWall do for i = 1, #vWall do
local PosX = EgtGetInfo( vWall[i].Id, 'POSX', 'd') local PosX = EgtGetInfo( vWall[i].Id, 'POSX', 'd')
local PosZ = EgtGetInfo( vWall[i].Id, 'POSZ', 'd')
if bProj and WD.DEFAULT_RAW_NO_EXTRA_WIDTH and #vWall == 1 then
PosX = 0
PosZ = 0
end
vWall[i].PosX = PosX + min( dExtraL, 1200) vWall[i].PosX = PosX + min( dExtraL, 1200)
if WD.USE_POSY then if WD.USE_POSY then
local PosY = EgtGetInfo( vWall[i].Id, 'POSY', 'd') local PosY = EgtGetInfo( vWall[i].Id, 'POSY', 'd')
@@ -287,7 +327,6 @@ if bToProcess then
else else
vWall[i].PosY = 0 vWall[i].PosY = 0
end end
local PosZ = EgtGetInfo( vWall[i].Id, 'POSZ', 'd')
vWall[i].PosZ = PosZ + dExtraW / 2 vWall[i].PosZ = PosZ + dExtraW / 2
end end
@@ -369,6 +408,12 @@ if bToProcess then
return return
end end
-- se impostato flag apposito, in vista il grezzo è uguale al pezzo
if bProj and WD.DEFAULT_RAW_NO_EXTRA_WIDTH and #vWall == 1 then
dRawL = vWall[1].Box:getDimX()
dRawW = vWall[1].Box:getDimY()
end
-- Verifico dimensioni massime grezzo -- Verifico dimensioni massime grezzo
if dRawL > WD.MAX_LENGTH + 10 * GEO.EPS_SMALL or dRawW > WD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > WD.MAX_HEIGHT + 10 * GEO.EPS_SMALL then if dRawL > WD.MAX_LENGTH + 10 * GEO.EPS_SMALL or dRawW > WD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > WD.MAX_HEIGHT + 10 * GEO.EPS_SMALL then
local sOut = 'Grezzo (' .. EgtNumToString( dRawL, 2) .. ' x ' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' .. local sOut = 'Grezzo (' .. EgtNumToString( dRawL, 2) .. ' x ' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
@@ -498,10 +543,20 @@ else
end end
-- Aggiorno eventuali dati ausiliari -- Aggiorno eventuali dati ausiliari
UpdateAuxData( sBtmFile) UpdateAuxData( sBtmFile)
-- Anche se non è da riprocessare, imposto nome file CN.
-- Se file TS7 importato da altro PC, 'WALL.FILE' è cambiato da un PC all'altro. Di conseguenza si deve aggiornare nome file che si andrà a generare.
local _, sName, _ = EgtSplitPath( WALL.FILE)
EgtSetInfo( EgtGetLastMachGroup(), 'NcName', sName .. '.cnc')
-- Passo in modalità lavora -- Passo in modalità lavora
EgtSetCurrMachGroup( EgtGetLastMachGroup()) EgtSetCurrMachGroup( EgtGetLastMachGroup())
-- Aggiorno posizione del grezzo
if WE.MoveRaw() then
bToRecalc = true
end
-- Se necessario eseguo aggiornamento con ricalcolo delle lavorazioni -- Se necessario eseguo aggiornamento con ricalcolo delle lavorazioni
if bToRecalc then if bToRecalc or WALL.FLAG == 3 or WALL.FLAG == 4 then
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>') EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
EgtImportSetup() EgtImportSetup()
EgtApplyAllMachinings() EgtApplyAllMachinings()
@@ -565,7 +620,8 @@ if ( WALL.FLAG == 0 and ( bToProcess or bToRecalc)) or WALL.FLAG == 3 or WALL.F
end end
-- *** Genero programma CN *** ( se richiesto) -- *** Genero programma CN *** ( se richiesto)
if WALL.FLAG == 0 or WALL.FLAG == 4 then local bIsGenerationEnabled = ( EgtVerifyKeyOption( 110) == false)
if bIsGenerationEnabled and ( WALL.FLAG == 0 or WALL.FLAG == 4) then
EgtOutLog( ' +++ Generating NC part program >>>') EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '') local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
if EgtGetExeVersion then if EgtGetExeVersion then
+2 -2
View File
@@ -549,7 +549,7 @@ else
-- Passo in modalità lavora -- Passo in modalità lavora
EgtSetCurrMachGroup( EgtGetLastMachGroup()) EgtSetCurrMachGroup( EgtGetLastMachGroup())
-- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni -- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni
if bToRecalc then if bToRecalc or WALL.FLAG == 3 or WALL.FLAG == 4 then
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>') EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
EgtImportSetup() EgtImportSetup()
EgtApplyAllMachinings() EgtApplyAllMachinings()
@@ -613,7 +613,7 @@ if ( WALL.FLAG == 0 and ( bToProcess or bToRecalc)) or WALL.FLAG == 3 or WALL.F
end end
-- *** Genero programma CN *** ( se richiesto) -- *** Genero programma CN *** ( se richiesto)
local bIsGenerationEnabled = ( EgtGetNumberFromIni( 'Mach', 'NoPartProgram', 0, EgtGetIniFile()) == 0) local bIsGenerationEnabled = ( EgtVerifyKeyOption( 110) == false)
if bIsGenerationEnabled and ( WALL.FLAG == 0 or WALL.FLAG == 4) then if bIsGenerationEnabled and ( WALL.FLAG == 0 or WALL.FLAG == 4) then
EgtOutLog( ' +++ Generating NC part program >>>') EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '') local sInfo = 'EgtCAM5' .. EgtIf( EgtIs64bit(), ' 64bit', '')
+1
View File
@@ -4,6 +4,7 @@ REM Per togliere info di debug aggiungere flag -s prima del nome del file di inp
REM Compilazione 32 e 64 bit REM Compilazione 32 e 64 bit
\EgtProg\Dll32\luac54 -o bin\LuaLibs\Squaring.lua -s LuaLibs\Squaring.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WallExec.lua -s LuaLibs\WallExec.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\WallExec.lua -s LuaLibs\WallExec.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WallLib.lua -s LuaLibs\WallLib.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\WallLib.lua -s LuaLibs\WallLib.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WMachiningLib.lua -s LuaLibs\WMachiningLib.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\WMachiningLib.lua -s LuaLibs\WMachiningLib.lua
+494
View File
@@ -0,0 +1,494 @@
-- Squaring.lua by Egaltech s.r.l. 2024/10/15
-- Libreria squadratura pareti
-- Tabella per definizione modulo
local Squaring = {}
-- Include
require( 'EgtBase')
EgtOutLog( ' Squaring started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
-------------------------------------------------------------------------------------------------------------
local function IsToolOk( Tool, dRawPartHeight)
local bIsToolOk = false
local bToolExists = false
local bToolCanReachDepth = false
local dMaxOvermaterial = 0
if type( WD.SQUARING_MAX_OVERMATERIAL) == "number" then
dMaxOvermaterial = WD.SQUARING_MAX_OVERMATERIAL
end
bToolExists = ( next( Tool) ~= nil)
if bToolExists then
if Tool.nType == MCH_TY.MILL_NOTIP then
bToolCanReachDepth = ( Tool.dThickness > dMaxOvermaterial - 10 * GEO.EPS_SMALL)
and ( Tool.dSideDepth > dRawPartHeight - 10 * GEO.EPS_SMALL)
else
bToolCanReachDepth = Tool.dMaxDepth > dRawPartHeight - 10 * GEO.EPS_SMALL
end
end
bIsToolOk = bToolExists and bToolCanReachDepth
return bIsToolOk
end
-------------------------------------------------------------------------------------------------------------
function Squaring.GetTools()
-- TODO vedere se questo valore è coerente sulle diverse macchine
local dHeadEncumberance = 130
local Tool = {}
local SquaringTools = {}
SquaringTools.Blade = {}
SquaringTools.Diskmill = {}
SquaringTools.Mill = {}
SquaringTools.Blade.H1 = {}
SquaringTools.Blade.H2 = {}
SquaringTools.Blade.H7 = {}
SquaringTools.Diskmill.H1 = {}
SquaringTools.Diskmill.H7 = {}
SquaringTools.Mill.H1 = {}
SquaringTools.Mill.H7 = {}
Tool.sName = EgtTdbGetFirstTool( MCH_TF.SAWBLADE + MCH_TF.MILL + MCH_TF.MORTISE)
while Tool.sName ~= '' do
EgtTdbSetCurrTool( Tool.sName)
local bIsToolLoadedOnSetup = EgtFindToolInCurrSetup( Tool.sName)
local bIsSquaringTool = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SQUARING', 'b') or false
Tool.nType = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
Tool.dDiameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
Tool.dMaxMaterial = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
Tool.dThickness = EgtIf( ( Tool.nType == MCH_TY.SAW_FLAT or Tool.nType == MCH_TY.SAW_STD), EgtTdbGetCurrToolParam( MCH_TP.THICK), Tool.dMaxMaterial)
Tool.dMaxDepth = EgtTdbGetCurrToolMaxDepth() or Tool.dMaxMaterial
Tool.sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
Tool.bIsCcw = EgtTdbGetCurrToolParam( MCH_TP.SPEED) < 0
Tool.dFeed = EgtTdbGetCurrToolParam( MCH_TP.FEED)
Tool.dStartFeed = EgtTdbGetCurrToolParam( MCH_TP.STARTFEED)
Tool.dEndFeed = EgtTdbGetCurrToolParam( MCH_TP.ENDFEED)
Tool.dTipFeed = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED)
Tool.dMinFeed = EgtTdbGetCurrToolParam( MCH_TP.MINFEED)
Tool.dStep = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'STEP', 'd') or EgtIf( ( Tool.nType == MCH_TY.SAW_FLAT or Tool.nType == MCH_TY.SAW_STD), ( Tool.dDiameter / 3), ( Tool.dMaxMaterial / 3))
Tool.dSideStep = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDESTEP', 'd') or ( Tool.dDiameter / 3)
Tool.dSideDepth = Tool.dDiameter / 2 - dHeadEncumberance
if bIsToolLoadedOnSetup and Tool.nType and bIsSquaringTool then
-- lame
if Tool.nType == MCH_TY.SAW_FLAT or Tool.nType == MCH_TY.SAW_STD then
SquaringTools.Blade[Tool.sHead] = Tool
Tool.bIsPathCw = Tool.bIsCcw
Tool.dSideStep = Tool.dStep
Tool.dStep = Tool.dThickness
-- frese standard
elseif Tool.nType == MCH_TY.MILL_STD then
SquaringTools.Mill[Tool.sHead] = Tool
Tool.bIsPathCw = not Tool.bIsCcw
-- truciolatori
elseif Tool.nType == MCH_TY.MILL_NOTIP then
SquaringTools.Diskmill[Tool.sHead] = Tool
Tool.bIsPathCw = Tool.bIsCcw
end
end
Tool = {}
Tool.sName = EgtTdbGetNextTool( MCH_TF.SAWBLADE + MCH_TF.MILL + MCH_TF.MORTISE)
end
return SquaringTools
end
-------------------------------------------------------------------------------------------------------------
function Squaring.AreToolsOk( sSquaringTool, SquaringTools, dRawPartHeight)
local bAreToolsOk = false
if sSquaringTool == 'DoubleDiskmill' then
bAreToolsOk = ( IsToolOk( SquaringTools.Blade.H2, dRawPartHeight)
and IsToolOk( SquaringTools.Diskmill.H1, dRawPartHeight)
and IsToolOk( SquaringTools.Diskmill.H7, dRawPartHeight))
elseif sSquaringTool == 'DoubleDiskmillAndBlade' then
bAreToolsOk = ( IsToolOk( SquaringTools.Blade.H2, dRawPartHeight)
and ( IsToolOk( SquaringTools.Diskmill.H1, dRawPartHeight) or IsToolOk( SquaringTools.Diskmill.H7, dRawPartHeight)))
elseif sSquaringTool == 'DoubleBlade' then
bAreToolsOk = ( IsToolOk( SquaringTools.Blade.H2, dRawPartHeight)
and ( IsToolOk( SquaringTools.Blade.H1, dRawPartHeight) or IsToolOk( SquaringTools.Blade.H7, dRawPartHeight)))
elseif sSquaringTool == 'Diskmill' then
bAreToolsOk = IsToolOk( SquaringTools.Diskmill.H1, dRawPartHeight) or IsToolOk( SquaringTools.Diskmill.H7, dRawPartHeight)
elseif sSquaringTool == 'Blade' then
bAreToolsOk = IsToolOk( SquaringTools.Blade.H2, dRawPartHeight)
elseif sSquaringTool == 'DoubleMill' then
bAreToolsOk = IsToolOk( SquaringTools.Mill.H1, dRawPartHeight) and IsToolOk( SquaringTools.Mill.H7, dRawPartHeight)
elseif sSquaringTool == 'Mill' then
bAreToolsOk = IsToolOk( SquaringTools.Mill.H1, dRawPartHeight) or IsToolOk( SquaringTools.Mill.H7, dRawPartHeight)
else
error( 'Squaring Tool not recognized')
end
return bAreToolsOk
end
-------------------------------------------------------------------------------------------------------------
function Squaring.CalculateParameters( sSquaringTool, SquaringTools, RawPart, vPart)
local SquaringParameters = {}
local sOrigCorner = EgtGetInfo( RawPart.nId, 'ORIGCORNER')
local bShrinkToParts = ( WD.SQUARING_TYPE == 2)
local bSquaringStartsOnReference = ( type( WD.SQUARING_STARTS_ON_REFERENCE) == "boolean") and ( WD.SQUARING_STARTS_ON_REFERENCE == true)
local dOffsetXY = 0
local dExtendZ = 0
if type( WD.SQUARING_OFFSET_XY) == "number" and ( WD.SQUARING_TYPE < 2) then
dOffsetXY = WD.SQUARING_OFFSET_XY
end
if type( WD.SQUARING_EXTEND_Z) == "number" then
dExtendZ = WD.SQUARING_EXTEND_Z
end
local Front = { sSide = 'Front'}
local Right = { sSide = 'Right'}
local Back = { sSide = 'Back'}
local Left = { sSide = 'Left'}
local b3Squaring = BBox3d( RawPart.b3)
-- se squadratura sui pezzi invece che sul master panel, si costruisce il box minimo che contiene tutti i pezzi
if bShrinkToParts then
b3Squaring = BBox3d( vPart[1].Box:getCenter())
for i = 1, #vPart do
b3Squaring:Add( vPart[i].Box)
end
end
local dDimX = b3Squaring:getDimX()
local dDimY = b3Squaring:getDimY()
local pt1 = b3Squaring:getMin() + Point3d( -dOffsetXY, -dOffsetXY, -dExtendZ)
local pt2 = pt1 + Point3d( dDimX + 2 * dOffsetXY, 0, 0)
local pt3 = pt2 + Point3d( 0, dDimY + 2 * dOffsetXY,0 )
local pt4 = pt3 + Point3d( -dDimX - 2 * dOffsetXY, 0, 0)
b3Squaring:Add( pt1)
b3Squaring:Add( pt2)
b3Squaring:Add( pt3)
b3Squaring:Add( pt4)
Front.nId = EgtLine( RawPart.nId, pt1, pt2, GDB_RT.GLOB)
Right.nId = EgtLine( RawPart.nId, pt2, pt3, GDB_RT.GLOB)
Back.nId = EgtLine( RawPart.nId, pt3, pt4, GDB_RT.GLOB)
Left.nId = EgtLine( RawPart.nId, pt4, pt1, GDB_RT.GLOB)
if not ( sSquaringTool == 'DoubleMill') and not ( sSquaringTool == 'Mill') then
EgtModifyCurveExtrusion( Front.nId, -Y_AX(), GDB_RT.GLOB)
EgtModifyCurveExtrusion( Right.nId, X_AX(), GDB_RT.GLOB)
EgtModifyCurveExtrusion( Back.nId, Y_AX(), GDB_RT.GLOB)
EgtModifyCurveExtrusion( Left.nId, -X_AX(), GDB_RT.GLOB)
end
EgtSetName( Front.nId, 'SquaringGeometry')
EgtSetName( Right.nId, 'SquaringGeometry')
EgtSetName( Back.nId, 'SquaringGeometry')
EgtSetName( Left.nId, 'SquaringGeometry')
-- in base al caso si assegna l'utensile al lato
if sSquaringTool == 'DoubleDiskmill' then
Left.Tool = SquaringTools.Diskmill.H1
Right.Tool = SquaringTools.Blade.H2
Front.Tool = SquaringTools.Diskmill.H1
Front.ToolDouble = SquaringTools.Diskmill.H7
Front.sSide = 'Front+Back'
elseif sSquaringTool == 'DoubleDiskmillAndBlade' then
Left.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
Right.Tool = SquaringTools.Blade.H2
Front.Tool = SquaringTools.Blade.H2
Front.ToolDouble = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
Front.sSide = 'Front+Back'
elseif sSquaringTool == 'DoubleBlade' then
Left.Tool = SquaringTools.Blade.H2
Right.Tool = SquaringTools.Blade.H2
Front.Tool = SquaringTools.Blade.H2
Front.ToolDouble = SquaringTools.Blade.H1 or SquaringTools.Blade.H7
Front.sSide = 'Front+Back'
elseif sSquaringTool == 'Diskmill' then
Left.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
Back.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
Right.Tool = SquaringTools.Blade.H2
Front.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
elseif sSquaringTool == 'Blade' then
Left.Tool = SquaringTools.Blade.H2
Back.Tool = SquaringTools.Blade.H2
Right.Tool = SquaringTools.Blade.H2
Front.Tool = SquaringTools.Blade.H2
elseif sSquaringTool == 'DoubleMill' then
Left.Tool = SquaringTools.Mill.H1
Right.Tool = SquaringTools.Mill.H1
Front.Tool = SquaringTools.Mill.H1
Front.ToolDouble = SquaringTools.Mill.H7
Front.sSide = 'Front+Back'
elseif sSquaringTool == 'Mill' then
Left.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
Back.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
Right.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
Front.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
end
-- l'ordinamento delle linee dipende dal verso di percorrenza e, se attivato, dal riferimento utilizzato
-- con doppio l'ordine cambia
-- lato lungo lavorato in doppio
if not Back.Tool then
for i = 1, 3 do
SquaringParameters[i] = {}
end
if Front.Tool.bIsPathCw then
if bSquaringStartsOnReference and ( sOrigCorner == 'BL' or sOrigCorner == 'BM') then
SquaringParameters[1] = Front
SquaringParameters[2] = Left
SquaringParameters[3] = Right
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
SquaringParameters[1] = Right
SquaringParameters[2] = Front
SquaringParameters[3] = Left
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
SquaringParameters[1] = Right
SquaringParameters[2] = Front
SquaringParameters[3] = Left
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TL' or sOrigCorner == 'TM') then
SquaringParameters[1] = Left
SquaringParameters[2] = Front
SquaringParameters[3] = Right
else
SquaringParameters[1] = Right
SquaringParameters[2] = Front
SquaringParameters[3] = Left
end
else
if bSquaringStartsOnReference and ( sOrigCorner == 'BL' or sOrigCorner == 'BM') then
SquaringParameters[1] = Left
SquaringParameters[2] = Front
SquaringParameters[3] = Right
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
SquaringParameters[1] = Front
SquaringParameters[2] = Right
SquaringParameters[3] = Left
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
SquaringParameters[1] = Front
SquaringParameters[2] = Right
SquaringParameters[3] = Left
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TL' or sOrigCorner == 'TM') then
SquaringParameters[1] = Left
SquaringParameters[2] = Front
SquaringParameters[3] = Right
else
SquaringParameters[1] = Left
SquaringParameters[2] = Front
SquaringParameters[3] = Right
end
end
-- doppio non attivo
else
for i = 1, 4 do
SquaringParameters[i] = {}
end
if Front.Tool.bIsPathCw then
if bSquaringStartsOnReference and ( sOrigCorner == 'BL' or sOrigCorner == 'BM') then
SquaringParameters[1] = Front
SquaringParameters[2] = Left
SquaringParameters[3] = Back
SquaringParameters[4] = Right
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
SquaringParameters[1] = Back
SquaringParameters[2] = Right
SquaringParameters[3] = Front
SquaringParameters[4] = Left
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
SquaringParameters[1] = Right
SquaringParameters[2] = Front
SquaringParameters[3] = Left
SquaringParameters[4] = Back
else
SquaringParameters[1] = Left
SquaringParameters[2] = Back
SquaringParameters[3] = Right
SquaringParameters[4] = Front
end
else
if bSquaringStartsOnReference and ( sOrigCorner == 'TL' or sOrigCorner == 'TM') then
SquaringParameters[1] = Back
SquaringParameters[2] = Left
SquaringParameters[3] = Front
SquaringParameters[4] = Right
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
SquaringParameters[1] = Right
SquaringParameters[2] = Back
SquaringParameters[3] = Left
SquaringParameters[4] = Front
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
SquaringParameters[1] = Front
SquaringParameters[2] = Right
SquaringParameters[3] = Back
SquaringParameters[4] = Left
else
SquaringParameters[1] = Left
SquaringParameters[2] = Front
SquaringParameters[3] = Right
SquaringParameters[4] = Back
end
end
end
return SquaringParameters, b3Squaring
end
-------------------------------------------------------------------------------------------------------------
function Squaring.AddMachinings( SquaringParameters, b3Squaring, nFirstOperationId)
local nNotOkCount = 0
local sMsgTotal = ''
local dSquaringHeight = b3Squaring:getDimZ()
local dExtendPath = 0
local dMaxOvermaterial = 0
if type( WD.SQUARING_MAX_OVERMATERIAL) == "number" then
dMaxOvermaterial = WD.SQUARING_MAX_OVERMATERIAL
end
local bUseZigZagStep = ( type( WD.SQUARING_USE_ZIGZAG) == "boolean") and ( WD.SQUARING_USE_ZIGZAG == true)
for i = 1, #SquaringParameters do
local dToolRadius = SquaringParameters[i].Tool.dDiameter / 2
local vtExtr = EgtCurveExtrusion( SquaringParameters[i].nId, GDB_RT.GLOB)
local bIsVerticalMilling = false
if AreSameVectorApprox( vtExtr, Z_AX()) then
bIsVerticalMilling = true
end
-- calcolo step laterale
local MachiningSteps = { nCount = 1, dStep = 0}
if not bIsVerticalMilling then
MachiningSteps = WM.GetMachiningSteps( dSquaringHeight, SquaringParameters[i].Tool.dSideStep)
end
for j = 1, MachiningSteps.nCount do
local nOperationId = EgtCreateMachining( 'SQUARING_' .. SquaringParameters[i].sSide, MCH_OY.MILLING, SquaringParameters[i].Tool.sName)
-- geometria
EgtSetMachiningGeometry( SquaringParameters[i].nId)
-- profondità di lavoro
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 0)
-- workside e inversione
if SquaringParameters[i].Tool.bIsPathCw then
if SquaringParameters[i].Tool.nType == MCH_TY.MILL_STD then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
else
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
if SquaringParameters[i].Tool.nType == MCH_TY.MILL_STD then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
else
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
end
EgtSetMachiningParam( MCH_MP.INVERT, false)
end
-- distanza di sicurezza
if bIsVerticalMilling then
EgtSetMachiningParam( MCH_MP.STARTPOS, WD.CUT_SIC + dSquaringHeight)
else
EgtSetMachiningParam( MCH_MP.STARTPOS, WD.CUT_SIC)
end
-- overlap
EgtSetMachiningParam( MCH_MP.OVERL, 0)
-- tipo di step
if bIsVerticalMilling and bUseZigZagStep then
EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ZIGZAG)
else
EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ONEWAY)
end
-- step
if bIsVerticalMilling then
EgtSetMachiningParam( MCH_MP.STEP, SquaringParameters[i].Tool.dStep)
else
EgtSetMachiningParam( MCH_MP.STEP, 0)
end
-- offset radiale
local dRadialOffset = 0
if not bIsVerticalMilling then
dRadialOffset = ( MachiningSteps.nCount - j) * MachiningSteps.dStep
end
EgtSetMachiningParam( MCH_MP.OFFSR, dRadialOffset)
-- offset longitudinale
EgtSetMachiningParam( MCH_MP.OFFSL, 0)
-- inversione utensile
EgtSetMachiningParam( MCH_MP.TOOLINVERT, false)
-- faceuse
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.NONE)
-- angoli suggeriti
EgtSetMachiningParam( MCH_MP.INITANGS, '')
-- asse bloccato
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, '')
-- SCC
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.NONE)
-- calcolo estensione percorso
if bIsVerticalMilling then
-- per utensili che lavorano di fianco, si deve partire fuori dall'altezza del grezzo
dExtendPath = dMaxOvermaterial + dToolRadius + WD.COLL_SIC
else
-- si calcola l'impronta utensile per uscire quanto basta a garantire il maxOvermaterial, con una distanza di sicurezza
dExtendPath = dMaxOvermaterial + WD.COLL_SIC + dToolRadius - ( dToolRadius - sqrt( dToolRadius * dToolRadius - ( ( dToolRadius - dSquaringHeight) * ( dToolRadius - dSquaringHeight))))
end
-- approccio
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtendPath)
EgtSetMachiningParam( MCH_MP.LITANG, 0)
if bIsVerticalMilling then
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
else
-- per utensili che lavorano di fianco, si deve partire fuori dall'altezza del grezzo
EgtSetMachiningParam( MCH_MP.LIPERP, WD.CUT_SIC + dSquaringHeight)
end
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
EgtSetMachiningParam( MCH_MP.LICOMPLEN, 0)
-- retrazione
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.LINEAR)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtendPath)
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
if bIsVerticalMilling then
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
else
-- per utensili che lavorano di fianco, si deve partire fuori dall'altezza del grezzo
EgtSetMachiningParam( MCH_MP.LOPERP, WD.CUT_SIC + dSquaringHeight)
end
EgtSetMachiningParam( MCH_MP.LOELEV, 0)
EgtSetMachiningParam( MCH_MP.LOCOMPLEN, 0)
-- note utente
local sUserNotes = ''
sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
if SquaringParameters[i].ToolDouble then
local dYMirrorAx
local b3Tab = EgtGetTableArea()
dYMirrorAx = b3Squaring:getCenter():getY() - b3Tab:getMin():getY()
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', 2)
sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', dYMirrorAx)
sUserNotes = EgtSetValInNotes( sUserNotes, 'TOOLDOUBLE', SquaringParameters[i].ToolDouble.sName)
end
if not bIsVerticalMilling then
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', 0)
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
local bOk = EgtApplyMachining( true, false)
-- la squadratura va sempre prima delle eventuali altre lavorazioni
if nFirstOperationId then
EgtRelocateGlob( nOperationId, nFirstOperationId, GDB_IN.BEFORE)
end
if not bOk then
local _, sMsg = EgtGetLastMachMgrError()
nNotOkCount = nNotOkCount + 1
sMsgTotal = sMsgTotal ..'\n' .. ( sMsg or '')
end
end
end
return ( nNotOkCount < 1), sMsgTotal
end
-------------------------------------------------------------------------------------------------------------
function Squaring.AddScrapRemoval( nFirstOperationId)
-- pulizia sfridi alla prima lavorazione dopo la squadratura
EgtSetCurrMachining( nFirstOperationId)
local sMachiningNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
sMachiningNotes = sMachiningNotes .. 'ScrapRemove=1;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sMachiningNotes)
end
-------------------------------------------------------------------------------------------------------------
return Squaring
+38 -4
View File
@@ -148,18 +148,27 @@ function WMachiningLib.FindSawing( sType)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function WMachiningLib.FindDrilling( dDiam, dDepth, sHead, bOnlyPockets) function WMachiningLib.FindDrilling( dDiam, dDepth, sHead, bOnlyPockets, bUseMultiDrill, DrillingsToAvoid)
if bOnlyPockets == nil or not bOnlyPockets then if bOnlyPockets == nil or not bOnlyPockets then
-- ricerca sulle forature, dal diametro maggiore al minore -- ricerca sulle forature, dal diametro maggiore al minore
for i = #Drillings, 1, -1 do for i = #Drillings, 1, -1 do
local Drilling = Drillings[i] local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == 'Drill' and SetCurrMachiningAndTool( Drilling.Name) then if Drilling.On and EgtIf( bUseMultiDrill, Drilling.Type == 'MultiDrill', Drilling.Type == 'Drill') and SetCurrMachiningAndTool( Drilling.Name) then
local bIsToAvoid = false
if DrillingsToAvoid then
for j = 1, #DrillingsToAvoid do
if Drilling.Name == DrillingsToAvoid[j] then
bIsToAvoid = true
end
end
end
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if nMchType == MCH_MY.DRILLING and if nMchType == MCH_MY.DRILLING and
dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - WD.DRILL_TOL - 10 * GEO.EPS_SMALL and ( not bIsToAvoid) and
( not dDiam or ( dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - WD.DRILL_TOL - 10 * GEO.EPS_SMALL)) and
( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) and ( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) and
(( not sHead and sMyHead ~= 'H5' and sMyHead ~= 'H6') or sHead == sMyHead) then (( not sHead and sMyHead ~= 'H5' and sMyHead ~= 'H6') or sHead == sMyHead) then
return Drilling.Name, Drilling.Type, dTMaxMat return Drilling.Name, Drilling.Type, dTMaxMat
@@ -167,16 +176,29 @@ function WMachiningLib.FindDrilling( dDiam, dDepth, sHead, bOnlyPockets)
end end
end end
end end
-- se MultiDrill non si prova il DrillPocket
if bUseMultiDrill then
return
end
-- ricerca sulle svuotature, dal diametro maggiore al minore -- ricerca sulle svuotature, dal diametro maggiore al minore
for i = #Drillings, 1, -1 do for i = #Drillings, 1, -1 do
local Drilling = Drillings[i] local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == 'Pocket' and SetCurrMachiningAndTool( Drilling.Name) then if Drilling.On and Drilling.Type == 'Pocket' and SetCurrMachiningAndTool( Drilling.Name) then
local bIsToAvoid = false
if DrillingsToAvoid then
for j = 1, #DrillingsToAvoid do
if Drilling.Name == DrillingsToAvoid[j] then
bIsToAvoid = true
end
end
end
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth()) local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth())
local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD) local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if nMchType == MCH_MY.POCKETING and if nMchType == MCH_MY.POCKETING and
dTDiam < dDiam - 10 * GEO.EPS_SMALL and ( not bIsToAvoid) and
( not dDiam or ( dTDiam < dDiam - 10 * GEO.EPS_SMALL)) and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and ( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( ( not sHead and sMyHead ~= 'H5' and sMyHead ~= 'H6') or sHead == sMyHead) then ( ( not sHead and sMyHead ~= 'H5' and sMyHead ~= 'H6') or sHead == sMyHead) then
return Drilling.Name, Drilling.Type, dTMaxDepth return Drilling.Name, Drilling.Type, dTMaxDepth
@@ -266,5 +288,17 @@ function WMachiningLib.IsMachiningOkForDouble( sMachining)
return bDoubleOk return bDoubleOk
end end
-------------------------------------------------------------------------------------------------------------
function WMachiningLib.GetMachiningSteps( dMachiningDepth, dStep)
local MachiningSteps = {}
MachiningSteps.dStep = 0
MachiningSteps.nCount = ceil( ( dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep)
if MachiningSteps.nCount > 1 then
MachiningSteps.dStep = ( dMachiningDepth - dStep) / ( MachiningSteps.nCount - 1)
end
return MachiningSteps
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
return WMachiningLib return WMachiningLib
+6 -3
View File
@@ -36,14 +36,17 @@ end
function WPDC.Classify( Proc, b3Raw) function WPDC.Classify( Proc, b3Raw)
-- se una faccia, uso la classificazione dei tagli singoli -- se una faccia, uso la classificazione dei tagli singoli
if Proc.Fct == 1 then return Cut.Classify( Proc, b3Raw) end if Proc.Fct == 1 then return Cut.Classify( Proc, b3Raw) end
-- se più di due facce non si fa -- se più di due facce non si fa
if Proc.Fct > 2 then return false end if Proc.Fct > 2 then return false end
-- dati delle facce
-- se due facce si verifica solamente se le facce non sono troppo orientate verso il basso (per due facce unite sul lato lungo il check è fatto nella LapJoint)
local vtN = {} local vtN = {}
vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT)
vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT) vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT)
-- verifico se è lavorabile da sopra o di fianco local bIsMachinable = ( vtN[1]:getZ() >= ( WD.CUT_VZ_MIN or - 0.5)) and ( vtN[2]:getZ() >= ( WD.CUT_VZ_MIN or - 0.5))
return ( vtN[1]:getZ() >= - 0.01 or vtN[2]:getZ() >= - 0.01)
return bIsMachinable
end end
---------------------------------------------------------------------- ----------------------------------------------------------------------
+192 -56
View File
@@ -27,6 +27,9 @@ local WM = require( 'WMachiningLib')
-- Parametri Q -- Parametri Q
local sContourOnly = 'Q01' -- 0=no, 1=si local sContourOnly = 'Q01' -- 0=no, 1=si
-- Per forature MultiDrill, lista lavorazioni già provate
local TriedDrillings = {}
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Riconoscimento della feature -- Riconoscimento della feature
@@ -56,7 +59,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Classificazione della feature -- Classificazione della feature
function WPD.Classify( Proc, b3Raw) function WPD.Classify( Proc, b3Raw, bUseMultiDrill)
-- recupero e verifico l'entità foro -- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
@@ -75,6 +78,10 @@ function WPD.Classify( Proc, b3Raw)
-- è lavorabile se non troppo inclinato -- è lavorabile se non troppo inclinato
return ( abs( vtExtr:getZ()) >= WD.DRILL_VZ_MIN) return ( abs( vtExtr:getZ()) >= WD.DRILL_VZ_MIN)
end end
-- multiforatore (cabinet)
if bUseMultiDrill then
return true
end
-- se con direzione asse Y e macchina con foratore orizzontale del giusto diametro -- se con direzione asse Y e macchina con foratore orizzontale del giusto diametro
if WD.HOR_DRILL_DIAM and abs( dDiam - WD.HOR_DRILL_DIAM) < WD.DRILL_TOL and AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then if WD.HOR_DRILL_DIAM and abs( dDiam - WD.HOR_DRILL_DIAM) < WD.DRILL_TOL and AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then
return true return true
@@ -255,7 +262,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function WPD.Make( Proc, nRawId, b3Raw) function WPD.Make( Proc, nRawId, b3Raw, bUseMultiDrill, DrillingsToAvoid)
-- recupero e verifico l'entità foro -- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end if AuxId then AuxId = AuxId + Proc.Id end
@@ -272,7 +279,7 @@ function WPD.Make( Proc, nRawId, b3Raw)
local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0) local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0)
-- verifico che il foro non sia fattibile solo da sotto -- verifico che il foro non sia fattibile solo da sotto
local bToInvert = ( vtExtr:getZ() < -0.1) local bToInvert = ( vtExtr:getZ() < -0.1)
if bToInvert and ( not bOpen or Proc.Flg ~= 1) then if bToInvert and ( not bOpen or Proc.Flg > 1) then
local sErr = 'Error : drilling from bottom impossible' local sErr = 'Error : drilling from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
@@ -299,57 +306,74 @@ function WPD.Make( Proc, nRawId, b3Raw)
end end
end end
end end
local bUseDLenToFindDrilling = true local sDrilling, nType
local sDrilling, nType = WM.FindDrilling( dDiam, dLen, sHead) if bUseMultiDrill then
if not sDrilling then sDrilling, nType = WM.FindDrilling( nil, nil, nil, nil, true, TriedDrillings)
bUseDLenToFindDrilling = false
sDrilling, nType = WM.FindDrilling( dDiam, nil, sHead)
end
-- se Proc è settata per essere specchiata cerco la lavorazione adatta e verifico possa essere effettivamente specchiata
if Proc.Double and Proc.Double == 2 then
local sDrillingBackup = sDrilling
sDrilling = WM.FindDrilling( dDiam, EgtIf( bUseDLenToFindDrilling, dLen, nil), 'H1')
if not IsMachiningOkForDouble( sDrilling) then
Proc.Double = 0
sDrilling = sDrillingBackup
end
end
if sHead and not sDrilling then
sDrilling, nType = WM.FindDrilling( dDiam, dLen)
if not sDrilling then if not sDrilling then
sDrilling, nType = WM.FindDrilling( dDiam) return false
end
else
local bUseDLenToFindDrilling = true
sDrilling, nType = WM.FindDrilling( dDiam, dLen, sHead)
if not sDrilling then
bUseDLenToFindDrilling = false
sDrilling, nType = WM.FindDrilling( dDiam, nil, sHead)
end
-- se Proc è settata per essere specchiata cerco la lavorazione adatta e verifico possa essere effettivamente specchiata
if Proc.Double and Proc.Double == 2 then
local sDrillingBackup = sDrilling
sDrilling = WM.FindDrilling( dDiam, EgtIf( bUseDLenToFindDrilling, dLen, nil), 'H1')
if not IsMachiningOkForDouble( sDrilling) then
Proc.Double = 0
sDrilling = sDrillingBackup
end
end
if sHead and not sDrilling then
sDrilling, nType = WM.FindDrilling( dDiam, dLen)
if not sDrilling then
sDrilling, nType = WM.FindDrilling( dDiam)
end
if sDrilling then sHead = '' end
end end
if sDrilling then sHead = '' end
end end
local bAngledContourDrill = false local bAngledContourDrill = false
local nAngledContourDrillId = GDB_ID.NULL local nAngledContourDrillId = GDB_ID.NULL
local dReduceDepth = 0 local dReduceDepth = 0
local bUseTabs = false
-- se trovata svuotatura, verifico se richiesta invece contornatura -- se trovata svuotatura, verifico se richiesta invece contornatura
if nType == 'Pocket' then if nType == 'Pocket' then
-- recupero eventuale flag per fare sola contornatura -- recupero eventuale flag per fare sola contornatura
local nContourOnly = ( EgtGetInfo( Proc.Id, sContourOnly, 'i') or 0) local nContourOnly = ( EgtGetInfo( Proc.Id, sContourOnly, 'i') or 0)
if nContourOnly == 1 then if nContourOnly == 1 then
-- imposto riduzione profondita' per evitare distacco pezzo interno -- se passante
dReduceDepth = 5 if Proc.Fcs > 0 and Proc.Fce > 0 then
-- se inclinato e passante -- se inclinato
if abs( vtExtr:getZ()) >= WD.DRILL_VZ_MIN and abs( vtExtr:getZ()) < 0.999 and Proc.Fcs > 0 and Proc.Fce > 0 then if abs( vtExtr:getZ()) >= WD.DRILL_VZ_MIN and abs( vtExtr:getZ()) < 0.999 then
-- gruppo ausiliario per preforo -- gruppo ausiliario per preforo
local nAddGrpId = WL.GetAddGroup( Proc.PartId) local nAddGrpId = WL.GetAddGroup( Proc.PartId)
-- ricavo contorno inferiore della superficie -- ricavo contorno inferiore della superficie
local nAngledCircleId, nAngledCircleCnt = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId) local nAngledCircleId, nAngledCircleCnt = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId)
local dMinZ = 10000 local dMinZ = 10000
local nMinCircleId = GDB_ID.NULL local nMinCircleId = GDB_ID.NULL
for Circleindex = 1, nAngledCircleCnt do for Circleindex = 1, nAngledCircleCnt do
local b3Circle = EgtGetBBoxGlob( nAngledCircleId + Circleindex -1, GDB_BB.EXACT) local b3Circle = EgtGetBBoxGlob( nAngledCircleId + Circleindex -1, GDB_BB.EXACT)
if b3Circle:getMin():getZ() < dMinZ then if b3Circle:getMin():getZ() < dMinZ then
nMinCircleId = nAngledCircleId + Circleindex -1 nMinCircleId = nAngledCircleId + Circleindex -1
end
end end
-- estrudo
EgtModifyCurveExtrusion( nMinCircleId, vtExtr, GDB_RT.GLOB)
EgtModifyCurveThickness( nMinCircleId, dLen)
bAngledContourDrill = true
nAngledContourDrillId = nMinCircleId
-- se non inclinato e abbastanza grande uso i tab
-- TODO se si risolve il problema dei tabs non funzionanti sotto ai 200 mm rimuovere il check sul diametro
elseif dDiam > 100 - 10 * GEO.EPS_SMALL then
bUseTabs = true
-- se non inclinato e piccolo non arrivo sul fondo
else
dReduceDepth = 5
end end
-- estrudo
EgtModifyCurveExtrusion( nMinCircleId, vtExtr, GDB_RT.GLOB)
EgtModifyCurveThickness( nMinCircleId, dLen)
bAngledContourDrill = true
nAngledContourDrillId = nMinCircleId
end end
sDrilling = WM.FindMilling( 'FreeContour', dLen, nil, nil, nil, nil, true) sDrilling = WM.FindMilling( 'FreeContour', dLen, nil, nil, nil, nil, true)
if sDrilling then if sDrilling then
@@ -437,11 +461,29 @@ function WPD.Make( Proc, nRawId, b3Raw)
-- aggiungo geometria -- aggiungo geometria
if bAngledContourDrill then if bAngledContourDrill then
EgtSetMachiningGeometry( nAngledContourDrillId) EgtSetMachiningGeometry( nAngledContourDrillId)
elseif bUseMultiDrill then
if Proc.SkippedGeometries and #Proc.SkippedGeometries > 0 then
EgtSetMachiningGeometry( Proc.SkippedGeometries)
else
local HolesGeometries = {}
-- aggiungo foro principale
table.insert( HolesGeometries, { AuxId, -1})
-- aggiungo eventuali altre geometrie connesse
if Proc.OtherGeometries and #Proc.OtherGeometries > 0 then
for i = 1, #Proc.OtherGeometries do
-- recupero geometria da lavorare
local OtherAuxId = Proc.OtherGeometries[i].Id + EgtGetInfo( Proc.OtherGeometries[i].Id, 'AUXID', 'i')
local Geometry = { OtherAuxId, -1}
table.insert( HolesGeometries, Geometry)
end
end
EgtSetMachiningGeometry( HolesGeometries)
end
else else
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
end end
-- eventuale inversione -- eventuale inversione
if nType == 'Drill' then if nType == 'Drill' or nType == 'MultiDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, bToInvert) EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
else else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert) EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
@@ -479,7 +521,9 @@ function WPD.Make( Proc, nRawId, b3Raw)
end end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_ZP local nSCC = MCH_SCC.ADIR_ZP
if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then if bUseMultiDrill then
nSCC = MCH_SCC.ADIR_NEAR
elseif AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YP nSCC = MCH_SCC.ADIR_YP
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
@@ -493,8 +537,13 @@ function WPD.Make( Proc, nRawId, b3Raw)
EgtOutLog( sMyWarn .. ' (process ' .. tostring( Proc.Id) .. ')') EgtOutLog( sMyWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
end end
end end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) if bUseMultiDrill then
-- leggo eventuali note esistenti della lavorazione local sDepth = 'TH'
EgtSetMachiningParam( MCH_MP.DEPTH_STR, sDepth)
else
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end
-- leggo eventuali note esistenti della lavorazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
-- se foratura o svuotatura, dichiarazione nessuna generazione sfridi per Vmill -- se foratura o svuotatura, dichiarazione nessuna generazione sfridi per Vmill
if nType == 'Drill' or nType == 'Pocket' then if nType == 'Drill' or nType == 'Pocket' then
@@ -515,20 +564,107 @@ function WPD.Make( Proc, nRawId, b3Raw)
sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', Proc.MirrorAx) sUserNotes = EgtSetValInNotes( sUserNotes, 'MirrorAx', Proc.MirrorAx)
end end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if bUseTabs then
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ONEWAY)
EgtSetMachiningParam( MCH_MP.LEAVETAB, true)
EgtSetMachiningParam( MCH_MP.TABHEIGHT, EgtClamp( dStep, 0.15 * dDepth, 0.25 * dDepth ))
EgtSetMachiningParam( MCH_MP.TABLEN, EgtClamp( 2 * dDiamT, 0.1 * dDiam, 0.2 * dDiam ))
EgtSetMachiningParam( MCH_MP.TABANGLE, 45)
EgtSetMachiningParam( MCH_MP.TABDIST, 100)
EgtSetMachiningParam( MCH_MP.TABMIN, 3)
EgtSetMachiningParam( MCH_MP.TABMAX, 3)
end
-- eseguo -- eseguo
if not EgtApplyMachining( true, false) then local bOk = EgtApplyMachining( true, false)
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) -- in caso di fori raggruppati vengono restituiti gli eventuali fori saltati
return false, sErr local SkippedGeometries = {}
else SkippedGeometries = EgtGetMachiningSkippedGeometry()
local _, sWarn = EgtGetMachMgrWarning( 0) local sMsgMaster
if EgtIsMachiningEmpty() then if bUseMultiDrill and SkippedGeometries and #SkippedGeometries > 0 then
EgtSetOperationMode( nMchId, false) if ( Proc.SkippedGeometries and ( #SkippedGeometries == #Proc.SkippedGeometries))
return false, sWarn or ( Proc.OtherGeometries and ( #SkippedGeometries == #Proc.OtherGeometries + 1))
else or ( not Proc.OtherGeometries and #SkippedGeometries == 1) then
sMyWarn = (sMyWarn or sWarn) EgtRemoveOperation( nMchId)
end
Proc.SkippedGeometries = SkippedGeometries
table.insert( TriedDrillings, sDrilling)
-- per provare tutte le MultiDrill disponibili si passano quelle già fatte come lavorazioni da ignorare
bOk = WPD.Make( Proc, nRawId, b3Raw, true, TriedDrillings)
-- non trovata lavorazione, si prova con le lavorazioni singole
if not bOk then
local bOkMaster = true
for i = #Proc.SkippedGeometries, 1, -1 do
local sErr
if Proc.OtherGeometries then
for j = 1, #Proc.OtherGeometries do
local AuxIdOtherGeometry = EgtGetInfo( Proc.OtherGeometries[j].Id, 'AUXID', 'i') or 0
if AuxIdOtherGeometry then AuxIdOtherGeometry = AuxIdOtherGeometry + Proc.OtherGeometries[j].Id end
if Proc.SkippedGeometries[i][1] == AuxIdOtherGeometry then
bOk, sErr = WPD.Make( Proc.OtherGeometries[j], nRawId, b3Raw, false)
if bOk then
Proc.OtherGeometries[j].bOk = true
else
Proc.OtherGeometries[j].bOk = false
end
Proc.OtherGeometries[j].sMsg = sErr
break
end
end
-- se nelle altre geometrie non è stato trovato, potrebbe essere la principale
local AuxIdProc = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxIdProc then AuxIdProc = AuxIdProc + Proc.Id end
if Proc.SkippedGeometries[i][1] == AuxIdProc then
bOk, sErr = WPD.Make( Proc, nRawId, b3Raw, false)
if not bOk then
bOkMaster = false
end
sMsgMaster = sErr
end
-- se non ci sono altre geometrie quella da fare è sicuramente la Proc principale
else
bOk, sErr = WPD.Make( Proc, nRawId, b3Raw, false)
if not bOk then
bOkMaster = false
end
sMsgMaster = sErr
end
if bOk then
table.remove( Proc.SkippedGeometries, i)
end
end
bOk = bOkMaster
end end
end end
-- se presenti geometrie aggiuntive, aggiunta informazioni per output statistiche
if Proc.OtherGeometries and #Proc.OtherGeometries > 0 then
for i = 1, #Proc.OtherGeometries do
if Proc.OtherGeometries[i].bOk == nil then
Proc.OtherGeometries[i].bOk = true
Proc.OtherGeometries[i].sMsg = ''
end
end
end
if not bUseMultiDrill then
if not bOk then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
local _, sWarn = EgtGetMachMgrWarning( 0)
if EgtIsMachiningEmpty() then
EgtSetOperationMode( nMchId, false)
return false, sWarn
else
sMyWarn = (sMyWarn or sWarn)
end
end
else
return bOk, sMsgMaster
end
-- se preforo inclinato impostato, inclinazione oltre limite impostato e foro non orizzontale -- se preforo inclinato impostato, inclinazione oltre limite impostato e foro non orizzontale
if WD.PREDRILL_DIAM and WD.PREDRILL_DIAM > 0 and vtExtr:getZ() < ( WD.PREDRILL_MINANGLE or 0.707) and vtExtr:getZ() > 0.1 then if WD.PREDRILL_DIAM and WD.PREDRILL_DIAM > 0 and vtExtr:getZ() < ( WD.PREDRILL_MINANGLE or 0.707) and vtExtr:getZ() > 0.1 then
-- gruppo ausiliario per preforo -- gruppo ausiliario per preforo
+109 -32
View File
@@ -175,6 +175,22 @@ local function IsPointOnRawLongEdges( ptCen, b3Raw)
return ( abs( ptCen:getY() - b3Raw:getMin():getY()) < 0.1 or abs( ptCen:getY() - b3Raw:getMax():getY()) < 0.1) return ( abs( ptCen:getY() - b3Raw:getMin():getY()) < 0.1 or abs( ptCen:getY() - b3Raw:getMax():getY()) < 0.1)
end end
---------------------------------------------------------------------
local function IsFaceOutsideSquaring( Proc, Face, b3Squaring)
-- faccia esterna al box di squadratura
if b3Squaring then
local b3SquaringReduced = BBox3d( b3Squaring)
b3SquaringReduced:expand( -0.1)
local b3Face = EgtSurfTmGetFacetBBoxGlob( Proc.Id, Face.Fac, GDB_BB.STANDARD)
if not OverlapsXY( b3SquaringReduced, b3Face) then
EgtOutLog( 'Proc ' .. Proc.Id .. ': skipped face ' .. Face.Fac .. ' outside squaring' )
return true
end
else
return false
end
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function GetOtherRegions( nPartId) local function GetOtherRegions( nPartId)
local vOthers = {} local vOthers = {}
@@ -388,9 +404,12 @@ local function GetFacesData( Proc, bOpposite, bCalclForBlade, dToolDiam, dToolMa
dLen = dLen - EgtIf( bCalclForBlade, dWhisk, 0) dLen = dLen - EgtIf( bCalclForBlade, dWhisk, 0)
nType = nType + 2 nType = nType + 2
end end
-- se lunghezza non significativa, non va inserito il taglio -- se feature taglio esteremità o longitudinale ed è 1 faccia, non controllo lunghezza minima. Si controlla solo interferenza altri pezzi
if dLen < MIN_LEN_CUT then if not( Proc.Prc == 10 and Proc.Fct == 1) then
nType = 4 -- se lunghezza non significativa, non va inserito il taglio
if dLen < MIN_LEN_CUT then
nType = 4
end
end end
-- numero dei lati -- numero dei lati
local nEdges = #(EgtSurfTmFacetAdjacencies( nNewProc, i - 1)[1]) local nEdges = #(EgtSurfTmFacetAdjacencies( nNewProc, i - 1)[1])
@@ -742,6 +761,27 @@ local function MakeLocalSurf( ptP1, ptP2, ptP3, nAddGrpId)
return nFaceId return nFaceId
end end
---------------------------------------------------------------------
local function GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrtho)
local _, EdgesEgt = EgtSurfTmGetFacetOutlineInfo( nSurfId, nFacet, GDB_ID.ROOT)
local nEdgeIndMax = 0
local dMaxComp = - GEO.INFINITO
for i = 1, #EdgesEgt do
local vtN = EdgesEgt[i].Norm
if EdgesEgt[i].Open then
vtN = -vtN
end
local dComp = vtN * vtOrtho
if dComp > dMaxComp then
nEdgeIndMax = i -1
dMaxComp = dComp
end
end
return nEdgeIndMax
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId, local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTypeConeCut, nAddGrpId,
dToolDiam, dThick, sMilling, dOffsAng, dDepthMach, dToolDiam, dThick, sMilling, dOffsAng, dDepthMach,
@@ -758,9 +798,9 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- creo superfice locale o esco -- creo superfice locale o esco
local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId) local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId)
if nSurfToAdd then if nSurfToAdd then
local nFacCntPre = EgtSurfTmFacetCount( nNewProc) local nFacCntPre = EgtSurfTmFacetCount( nNewProc.Id)
-- creo copia del percorso principale e gli aggiungo la nuova faccia -- creo copia del percorso principale e gli aggiungo la nuova faccia
nNewProcLoc = EgtCopyGlob( nNewProc, nAddGrpId) nNewProcLoc = EgtCopyGlob( nNewProc.Id, nAddGrpId)
nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true) nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true)
-- riordino le facce -- riordino le facce
ReorderFacesFromTab( nNewProcLoc, vFace) ReorderFacesFromTab( nNewProcLoc, vFace)
@@ -771,7 +811,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
return true, '' return true, ''
end end
else else
nNewProcLoc = nNewProc nNewProcLoc = nNewProc.Id
end end
-- prendo il primo versore -- prendo il primo versore
local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT) local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT)
@@ -828,7 +868,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
vtCheck:rotate( Z_AX(), dOffsAng) vtCheck:rotate( Z_AX(), dOffsAng)
end end
-- controllo se c'è collisione con le facce della superfice -- controllo se c'è collisione con le facce della superfice
if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2, if nTypeConeCut == 1 and CalcInterference( nNewProc.Id, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
dTall1, dTall2, dDiam3, dTall3) then dTall1, dTall2, dDiam3, dTall3) then
local sErr = 'Collision detect from clean corner tool and surface' local sErr = 'Collision detect from clean corner tool and surface'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -925,6 +965,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- trasformo in percorso -- trasformo in percorso
if #pAuxId > 0 then if #pAuxId > 0 then
AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true) AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true)
EgtSetInfo( AuxId, 'TASKID', nNewProc.TaskId)
EgtSetInfo( AuxId, 'CUTID', nNewProc.CutId)
end end
-- se non c'é il percorso do errore -- se non c'é il percorso do errore
if not AuxId then if not AuxId then
@@ -939,8 +981,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB) EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
end end
-- inserisco la lavorazione -- inserisco la lavorazione
local sName = 'Clean_' .. ( EgtGetName( nNewProc) or tostring( nNewProc)) local sName = 'Clean_' .. ( EgtGetName( nNewProc.Id) or tostring( nNewProc.Id))
local nMchId = WM.AddMachining( nNewProc, sName, sMilling) local nMchId = WM.AddMachining( nNewProc.Id, sName, sMilling)
if not nMchId then if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -1033,26 +1075,26 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
-- verifico se ciclo chiuso -- verifico se ciclo chiuso
local bClosed = ( abs( vFace[1].PrevAng) > 0.1) local bClosed = ( abs( vFace[1].PrevAng) > 0.1)
-- copio la feature nel layer di appoggio -- copio la feature nel layer di appoggio
local nNewProc local nNewProc = { CutId = Proc.CutId, TaskId = Proc.TaskId}
if nMasterNewProc then if nMasterNewProc then
nNewProc = nMasterNewProc nNewProc.Id = nMasterNewProc
else else
nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL nNewProc.Id = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
end end
local nFacCnt = EgtSurfTmFacetCount( nNewProc) local nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
local nFacInd, dDepth, nSurfInt local nFacInd, dDepth, nSurfInt
local bMakeLocSurf local bMakeLocSurf
-- RIMUOVERE -- RIMUOVERE
if false and nFacCnt <= 4 then if false and nFacCnt <= 4 then
-- recupero profondità e faccia di fondo -- recupero profondità e faccia di fondo
_, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId, bClosed) _, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc.Id, Proc.PartId, nAddGrpId, bClosed)
if nSurfInt then if nSurfInt then
-- aggiungo la faccia di fondo appena calcolata -- aggiungo la faccia di fondo appena calcolata
nNewProc = EgtSurfTmBySewing( nAddGrpId, { nNewProc, nSurfInt}, true) nNewProc.Id = EgtSurfTmBySewing( nAddGrpId, { nNewProc.Id, nSurfInt}, true)
-- riordino le facce -- riordino le facce
ReorderFacesFromTab( nNewProc, vFace) ReorderFacesFromTab( nNewProc.Id, vFace)
-- aggiorno numero di facce e assegno indice di quella di fondo (sempre ultima) -- aggiorno numero di facce e assegno indice di quella di fondo (sempre ultima)
nFacCnt = EgtSurfTmFacetCount( nNewProc) nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
nFacInd = nFacCnt - 1 nFacInd = nFacCnt - 1
else else
return true return true
@@ -1100,7 +1142,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
ptLoc2 = vFace[k].PPrev ptLoc2 = vFace[k].PPrev
end end
-- ricavo i punti e l'angolo interno -- ricavo i punti e l'angolo interno
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT) local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc.Id, nFace1, nFace2, GDB_ID.ROOT)
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza -- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
local tFacAdj = {} local tFacAdj = {}
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then
@@ -1138,8 +1180,8 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
i = i + 1 i = i + 1
end end
-- cancello la copia della superfice -- cancello la copia della superfice
if nNewProc then if nNewProc.Id then
EgtErase( nNewProc) EgtErase( nNewProc.Id)
end end
return true return true
end end
@@ -1275,6 +1317,11 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
EgtSetMachiningParam( MCH_MP.INVERT, false) EgtSetMachiningParam( MCH_MP.INVERT, false)
-- assegno utilizzo faccia -- assegno utilizzo faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
local nEdgeFaceUse = GetEdgeToMachineFromVector( Proc.Id, vFace[i].Fac, Z_AX())
if nEdgeFaceUse then
local sNoteEdgeFaceUse = 'EdgesFaceUse=' .. EgtNumToString( nEdgeFaceUse) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNoteEdgeFaceUse)
end
-- assegno affondamento -- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- assegno lato di lavoro -- assegno lato di lavoro
@@ -1428,6 +1475,13 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
EgtSetMachiningParam( MCH_MP.INVERT, false) EgtSetMachiningParam( MCH_MP.INVERT, false)
-- assegno utilizzo faccia -- assegno utilizzo faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
if #vGeom == 1 then
local nEdgeFaceUse = GetEdgeToMachineFromVector( Proc.Id, vGeom[1][2], Z_AX())
if nEdgeFaceUse then
local sNoteEdgeFaceUse = 'EdgesFaceUse=' .. EgtNumToString( nEdgeFaceUse) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNoteEdgeFaceUse)
end
end
-- assegno affondamento -- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- assegno lato di lavoro -- assegno lato di lavoro
@@ -1452,6 +1506,13 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
EgtSetMachiningParam( MCH_MP.INVERT, false) EgtSetMachiningParam( MCH_MP.INVERT, false)
-- assegno utilizzo faccia -- assegno utilizzo faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
if #vGeom == 1 then
local nEdgeFaceUse = GetEdgeToMachineFromVector( Proc.Id, vGeom[1][2], Z_AX())
if nEdgeFaceUse then
local sNoteEdgeFaceUse = 'EdgesFaceUse=' .. EgtNumToString( nEdgeFaceUse) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNoteEdgeFaceUse)
end
end
-- assegno affondamento -- assegno affondamento
-- EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
if bNotThrou then if bNotThrou then
@@ -1486,9 +1547,11 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
end end
--scrivo nell'operazione il vettore somma delle normali alle superfici che servirà per il doppio --scrivo nell'operazione il vettore somma delle normali alle superfici che servirà per il doppio
local vtNSum = Vector3d( 0, 0, 0) local vtNSum = Vector3d( 0, 0, 0)
for iGeom = 1, #vGeom do if Proc.Face and #Proc.Face > 0 then
local nFace = vGeom[iGeom][2] for iGeom = 1, #vGeom do
vtNSum = vtNSum + Proc.Face[ nFace + 1].VtN local nFace = vGeom[iGeom][2]
vtNSum = vtNSum + Proc.Face[ nFace + 1].VtN
end
end end
EgtSetInfo( nMchId or GDB_ID.NULL, 'NORM_SUM', vtNSum) EgtSetInfo( nMchId or GDB_ID.NULL, 'NORM_SUM', vtNSum)
-- eseguo -- eseguo
@@ -1543,6 +1606,11 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
EgtSetMachiningParam( MCH_MP.INVERT, false) EgtSetMachiningParam( MCH_MP.INVERT, false)
-- assegno utilizzo faccia -- assegno utilizzo faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN) EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
local nEdgeFaceUse = GetEdgeToMachineFromVector( Proc.Id, vFace[i].Fac, Z_AX())
if nEdgeFaceUse then
local sNoteEdgeFaceUse = 'EdgesFaceUse=' .. EgtNumToString( nEdgeFaceUse) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNoteEdgeFaceUse)
end
-- assegno affondamento -- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- assegno lato di lavoro -- assegno lato di lavoro
@@ -1703,13 +1771,13 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick) local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick, b3Squaring)
-- verifico se ciclo chiuso -- verifico se ciclo chiuso
local bClosed = ( abs( vFace[1].PrevAng) > 0.1) local bClosed = ( abs( vFace[1].PrevAng) > 0.1)
-- ciclo di inserimento dei tagli sulle facce del contorno in esame -- ciclo di inserimento dei tagli sulle facce del contorno in esame
for i = 1, #vFace do for i = 1, #vFace do
-- verifico se faccia da saltare, perchè macchina travi e faccia su bordo longitudinale esterno già finito -- verifico se faccia da saltare, perchè macchina travi e faccia su bordo longitudinale esterno già finito oppure se faccia fuori dal box di squadratura
local bToSkip = ( WD.BEAM_MACHINE and IsPointOnRawLongEdges( vFace[i].Cen, b3Raw)) local bToSkip = ( WD.BEAM_MACHINE and IsPointOnRawLongEdges( vFace[i].Cen, b3Raw)) or IsFaceOutsideSquaring( Proc, vFace[i], b3Squaring)
-- se non è faccia da saltare, inserisco il taglio di lama -- se non è faccia da saltare, inserisco il taglio di lama
if not bToSkip and vFace[i].Type ~= 4 then if not bToSkip and vFace[i].Type ~= 4 then
-- indice del successivo -- indice del successivo
@@ -1839,7 +1907,7 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function MakeByCut( Proc, nRawId, b3Raw) local function MakeByCut( Proc, nRawId, b3Raw, b3Squaring)
local sWarn = '' local sWarn = ''
-- ingombro del pezzo -- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( Proc.PartId, 'Box') local Ls = EgtGetFirstNameInGroup( Proc.PartId, 'Box')
@@ -1885,9 +1953,9 @@ local function MakeByCut( Proc, nRawId, b3Raw)
-- gruppo ausiliario -- gruppo ausiliario
local nAddGrpId = WL.GetAddGroup( Proc.PartId) local nAddGrpId = WL.GetAddGroup( Proc.PartId)
-- recupero i dati di tutte le facce -- recupero i dati di tutte le facce
local vFace, dMaxWidth, nNewProc = GetFacesData( Proc, bOpposite, true, dSawDiam, dSawMaxDepth, dSawThick, nAddGrpId, b3Raw, nil) local vFace, dMaxWidth, nNewProc = GetFacesData( Proc, bOpposite, true, dSawDiam, dSawMaxDepth, dSawThick, nAddGrpId, b3Raw)
-- inserimento dei tagli di lama -- inserimento dei tagli di lama
local bCtOk, sCtErr = AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick) local bCtOk, sCtErr = AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick, b3Squaring)
if not bCtOk then return bCtOk, sCtErr end if not bCtOk then return bCtOk, sCtErr end
-- se richiesta solo lama, esco -- se richiesta solo lama, esco
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0 local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
@@ -2099,6 +2167,12 @@ local function MakeByMill( Proc, nRawId, b3Raw)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) then elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
elseif ( Proc.Grp == 1 or Proc.Grp == 2) then
if bToolInv then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
else
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
end end
-- se lamatura affondata speciale (cliente 90480029), setto attacco e stacco al centro -- se lamatura affondata speciale (cliente 90480029), setto attacco e stacco al centro
@@ -2424,7 +2498,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
EgtErase( nAddedBottomSurface) EgtErase( nAddedBottomSurface)
end end
if not nFacet then if not nFacet then
return MakeByMill( Proc, nRawId, b3Raw) return MakeByMill( Proc, nRawId, b3Raw, b3Squaring)
end end
-- se ho creato la faccia di fondo utilizzo quella -- se ho creato la faccia di fondo utilizzo quella
local nSurfId = nProcTmWithAddedBottomSurfaceId or Proc.Id local nSurfId = nProcTmWithAddedBottomSurfaceId or Proc.Id
@@ -2571,7 +2645,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function WPF.Make( Proc, nRawId, b3Raw, vNLO) function WPF.Make( Proc, nRawId, b3Raw, vNLO, b3Squaring)
-- recupero la tipologia (contorno o tasca) -- recupero la tipologia (contorno o tasca)
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1) local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
-- se svuotatura -- se svuotatura
@@ -2583,6 +2657,9 @@ function WPF.Make( Proc, nRawId, b3Raw, vNLO)
ReorderFaces( Proc.Id, EgtSurfTmFacetCount( Proc.Id)) ReorderFaces( Proc.Id, EgtSurfTmFacetCount( Proc.Id))
-- recupero il tipo di lavorazione -- recupero il tipo di lavorazione
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0 local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
if WD.FORCE_MILL_CONTOUR == true then
nCntType = 2
end
-- se fresatura -- se fresatura
if nCntType == 2 then if nCntType == 2 then
return MakeByMill( Proc, nRawId, b3Raw) return MakeByMill( Proc, nRawId, b3Raw)
@@ -2594,7 +2671,7 @@ function WPF.Make( Proc, nRawId, b3Raw, vNLO)
return MakeByNail( Proc, nRawId, b3Raw, vNLO) return MakeByNail( Proc, nRawId, b3Raw, vNLO)
-- altrimenti, taglio con lama e pulizia angoli con fresa -- altrimenti, taglio con lama e pulizia angoli con fresa
else else
return MakeByCut( Proc, nRawId, b3Raw) return MakeByCut( Proc, nRawId, b3Raw, b3Squaring)
end end
end end
end end
+279 -247
View File
@@ -34,6 +34,7 @@
-- Miglioramenti sostanziali nella gestione delle tasche. -- Miglioramenti sostanziali nella gestione delle tasche.
-- 2023/11/16 Fresature a salire estese a groove cieche. -- 2023/11/16 Fresature a salire estese a groove cieche.
-- 2024/02/20 Piccola correzione ai casi in cui si utilizza il SIDESTEP. -- 2024/02/20 Piccola correzione ai casi in cui si utilizza il SIDESTEP.
-- 2024/08/09 In MakeByMill, se fresa Side trovata ma non applicabile, si considera come se non trovata
-- Tabella per definizione modulo -- Tabella per definizione modulo
local WPL = {} local WPL = {}
@@ -55,6 +56,7 @@ local MIN_LEN_CUT = 30
-- variabili assegnazione parametri Q -- variabili assegnazione parametri Q
local Q_SIDE_MILL = '' -- d local Q_SIDE_MILL = '' -- d
local Q_CORNER_CUT = '' -- i local Q_CORNER_CUT = '' -- i
local Q_USE_BLADE = '' -- i
-- variabile settaggio doppia lavorazione su angolo > 90 -- variabile settaggio doppia lavorazione su angolo > 90
local bMakeTwinCut = true local bMakeTwinCut = true
@@ -79,10 +81,12 @@ local function AssignQIdent( Proc)
-- reset assegnazione parametri Q -- reset assegnazione parametri Q
Q_SIDE_MILL = '' Q_SIDE_MILL = ''
Q_CORNER_CUT = '' Q_CORNER_CUT = ''
Q_USE_BLADE = ''
if Proc.Prc == 11 then if Proc.Prc == 11 then
Q_SIDE_MILL = 'Q02' -- i Q_SIDE_MILL = 'Q02' -- i
Q_CORNER_CUT = 'Q05' -- i Q_CORNER_CUT = 'Q05' -- i
Q_USE_BLADE = 'Q06' -- i
elseif Proc.Prc == 12 then elseif Proc.Prc == 12 then
Q_SIDE_MILL = 'Q02' -- i Q_SIDE_MILL = 'Q02' -- i
Q_CORNER_CUT = '' -- i Q_CORNER_CUT = '' -- i
@@ -111,7 +115,12 @@ local function EvaluateQParam( Proc)
-- 3 : scarico corner (tipo foro). -- 3 : scarico corner (tipo foro).
local nTypeCornerCut = EgtGetInfo( Proc.Id, Q_CORNER_CUT, 'i') or 0 local nTypeCornerCut = EgtGetInfo( Proc.Id, Q_CORNER_CUT, 'i') or 0
return nTypeCornerCut, nUseSideMillAsBlade -- Verifica forzatura utilizzo lama
-- 0 : automatico
-- 1 : usa lama
local nUseBlade = EgtGetInfo( Proc.Id, Q_USE_BLADE, 'i') or 0
return nTypeCornerCut, nUseSideMillAsBlade, nUseBlade
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -344,7 +353,7 @@ function WPL.FlipClassify( Proc)
end end
end end
-- se con fondo -- se con fondo
else elseif nFacInd2 then
-- calcolo la media delle normali delle facce di fondo ed assegno punteggio maggiore se positiva -- calcolo la media delle normali delle facce di fondo ed assegno punteggio maggiore se positiva
local vtN = {} local vtN = {}
vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
@@ -352,6 +361,9 @@ function WPL.FlipClassify( Proc)
if vtN[1]:getZ() == -1 or vtN[2]:getZ() == -1 then return 0, 100 end if vtN[1]:getZ() == -1 or vtN[2]:getZ() == -1 then return 0, 100 end
if vtN[1]:getZ() == 1 or vtN[2]:getZ() == 1 then return 100, 0 end if vtN[1]:getZ() == 1 or vtN[2]:getZ() == 1 then return 100, 0 end
nFlip0, nFlip1 = VerifyVtNMedia(Proc.Id, nFacInd, nFacInd2) nFlip0, nFlip1 = VerifyVtNMedia(Proc.Id, nFacInd, nFacInd2)
else
-- verifico che la normale del fondo permetta la lavorazione da sopra ed assegno punteggio di conseguenza
nFlip0, nFlip1 = VerifyVtN( Proc.Id, nFacInd)
end end
-- se 5 facce -- se 5 facce
elseif Proc.Fct == 5 then elseif Proc.Fct == 5 then
@@ -691,15 +703,15 @@ local function CalcInterference( nNewProc, vtExtr, ptCentr, dDiam1, dDiam2,
local ptCentrGrid1 = ptCentr + ( vtExtr * 0.01) local ptCentrGrid1 = ptCentr + ( vtExtr * 0.01)
local frOriTool = Frame3d( ptCentrGrid1, vtExtr) local frOriTool = Frame3d( ptCentrGrid1, vtExtr)
local bColl1 = EgtCDeConeSolid( frOriTool, dDiam1/2, dDiam2/2, dTall1, nNewProc, 0, GDB_RT.GLOB) local bColl1 = EgtTestConeSurface( frOriTool, dDiam1/2, dDiam2/2, dTall1, nNewProc, 0, GDB_RT.GLOB)
if bColl1 then return true end if bColl1 then return true end
local ptCentrGrid2 = ptCentr + ( vtExtr * ( dTall1 + 0.01)) local ptCentrGrid2 = ptCentr + ( vtExtr * ( dTall1 + 0.01))
frOriTool = Frame3d( ptCentrGrid2, vtExtr) frOriTool = Frame3d( ptCentrGrid2, vtExtr)
local bColl2 = EgtCDeCylSolid( frOriTool, dDiam2/2, (dTall2-dTall1), nNewProc, 0, GDB_RT.GLOB) local bColl2 = EgtTestCylSurface( frOriTool, dDiam2/2, (dTall2-dTall1), nNewProc, 0, GDB_RT.GLOB)
if bColl2 then return true end if bColl2 then return true end
local ptCentrGrid3 = ptCentr + ( vtExtr * ( dTall2 + 0.01)) local ptCentrGrid3 = ptCentr + ( vtExtr * ( dTall2 + 0.01))
frOriTool = Frame3d( ptCentrGrid3, vtExtr) frOriTool = Frame3d( ptCentrGrid3, vtExtr)
local bColl3 = EgtCDeCylSolid( frOriTool, dDiam3/2, (dTall3-dTall2), nNewProc, 0, GDB_RT.GLOB) local bColl3 = EgtTestCylSurface( frOriTool, dDiam3/2, (dTall3-dTall2), nNewProc, 0, GDB_RT.GLOB)
if bColl3 then return true end if bColl3 then return true end
-- restituisco risultato controllo collisioni -- restituisco risultato controllo collisioni
return false return false
@@ -759,9 +771,9 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- creo superfice locale o esco -- creo superfice locale o esco
local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId) local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId)
if nSurfToAdd then if nSurfToAdd then
local nFacCntPre = EgtSurfTmFacetCount( nNewProc) local nFacCntPre = EgtSurfTmFacetCount( nNewProc.Id)
-- creo copia del percorso principale e gli aggiungo la nuova faccia -- creo copia del percorso principale e gli aggiungo la nuova faccia
nNewProcLoc = EgtCopyGlob( nNewProc, nAddGrpId) nNewProcLoc = EgtCopyGlob( nNewProc.Id, nAddGrpId)
nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true) nNewProcLoc = EgtSurfTmBySewing( nAddGrpId, {nNewProcLoc,nSurfToAdd} , true)
-- riordino le facce -- riordino le facce
nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace) nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace)
@@ -774,7 +786,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
return true, '' return true, ''
end end
else else
nNewProcLoc = nNewProc nNewProcLoc = nNewProc.Id
end end
-- prendo il primo versore -- prendo il primo versore
local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT) local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT)
@@ -828,7 +840,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
vtCheck:rotate( Z_AX(), dOffsAng) vtCheck:rotate( Z_AX(), dOffsAng)
end end
-- controllo se c'è collisione con le facce della superfice -- controllo se c'è collisione con le facce della superfice
if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2, if nTypeConeCut == 1 and CalcInterference( nNewProc.Id, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
dTall1, dTall2, dDiam3, dTall3) then dTall1, dTall2, dDiam3, dTall3) then
local sErr = 'Collision detect from clean corner tool and surface' local sErr = 'Collision detect from clean corner tool and surface'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -925,6 +937,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- trasformo in percorso -- trasformo in percorso
if #pAuxId > 0 then if #pAuxId > 0 then
AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true) AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true)
EgtSetInfo( AuxId, 'TASKID', nNewProc.TaskId)
EgtSetInfo( AuxId, 'CUTID', nNewProc.CutId)
end end
-- se non c'é il percorso do errore -- se non c'é il percorso do errore
if not AuxId then if not AuxId then
@@ -939,8 +953,8 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB) EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
end end
-- inserisco la lavorazione -- inserisco la lavorazione
local sName = 'Clean_' .. ( EgtGetName( nNewProc) or tostring( nNewProc)) local sName = 'Clean_' .. ( EgtGetName( nNewProc.Id) or tostring( nNewProc.Id))
local nMchId = WM.AddMachining( nNewProc, sName, sMilling) local nMchId = WM.AddMachining( nNewProc.Id, sName, sMilling)
if not nMchId then if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -1034,27 +1048,27 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
end end
end end
-- copio la feature nel layer di appoggio -- copio la feature nel layer di appoggio
local nNewProc local nNewProc = { CutId = Proc.CutId, TaskId = Proc.TaskId}
if nMasterNewProc then if nMasterNewProc then
nNewProc = nMasterNewProc nNewProc.Id = nMasterNewProc
else else
nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL nNewProc.Id = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
end end
local nFacCnt = EgtSurfTmFacetCount( nNewProc) local nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
local nFacInd, dDimMin, dDimMax, dDepth, nSurfInt local nFacInd, dDimMin, dDimMax, dDepth, nSurfInt
local bMakeLocSurf local bMakeLocSurf
-- RIMUOVERE -- RIMUOVERE
if false and nFacCnt <= 4 then if false and nFacCnt <= 4 then
-- ottengo le dimensioni apertura, la normale e la faccia inferiore -- ottengo le dimensioni apertura, la normale e la faccia inferiore
dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId) dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc.Id, Proc.PartId, nAddGrpId)
if nSurfInt then if nSurfInt then
-- uso la dimensione minima anche nel caso che la cava sborda perchè la lavorazione potrebbe collidere con un pezzo limitrofo -- uso la dimensione minima anche nel caso che la cava sborda perchè la lavorazione potrebbe collidere con un pezzo limitrofo
local dMinWidth = dDimMin local dMinWidth = dDimMin
nNewProc = EgtSurfTmBySewing( nAddGrpId, {nNewProc,nSurfInt} , true) nNewProc.Id = EgtSurfTmBySewing( nAddGrpId, {nNewProc.Id,nSurfInt} , true)
-- riordino le facce -- riordino le facce
nNewProc = ReorderFacesFromTab( nNewProc, vFace) nNewProc.Id = ReorderFacesFromTab( nNewProc.Id, vFace)
-- acquisisco il numero della faccia -- acquisisco il numero della faccia
nFacCnt = EgtSurfTmFacetCount( nNewProc) nFacCnt = EgtSurfTmFacetCount( nNewProc.Id)
nFacInd = nFacCnt - 1 nFacInd = nFacCnt - 1
else else
local sErr = 'Error : cannot create base surface' local sErr = 'Error : cannot create base surface'
@@ -1106,7 +1120,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
ptLoc2 = vFace[k].PPrev ptLoc2 = vFace[k].PPrev
end end
-- ricavo i punti e l'angolo interno -- ricavo i punti e l'angolo interno
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT) local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc.Id, nFace1, nFace2, GDB_ID.ROOT)
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza -- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
local tFacAdj = {} local tFacAdj = {}
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then
@@ -1144,8 +1158,8 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
i = i + 1 i = i + 1
end end
-- cancello la copia della superfice -- cancello la copia della superfice
if nNewProc then if nNewProc.Id then
EgtErase(nNewProc) EgtErase( nNewProc.Id)
end end
return true return true
end end
@@ -1218,7 +1232,7 @@ local function MakeByChainSaw( Proc, nFacet, nRawId, b3Raw, dElev, dH, dV)
local sStartAngs local sStartAngs
if WD.GetChainSawStartAngs then if WD.GetChainSawStartAngs then
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacAdj, GDB_ID.ROOT) local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacAdj, GDB_ID.ROOT)
sStartAngs = WD.GetChainSawStartAngs( vtN2) sStartAngs = WD.GetChainSawStartAngs( vtN2, vtN, ptC)
end end
-- Lati chiusi -- Lati chiusi
local bOpenStart = false local bOpenStart = false
@@ -1372,13 +1386,13 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
if dMillDiam < dDiam or dMaxDepth < dElev then if dMillDiam < dDiam or dMaxDepth < dElev then
local sErr = 'Error : Side Elevation too big' local sErr = 'Error : Side Elevation too big'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr, true
end end
local dMillExtra = dMillTotLen - dMillLen local dMillExtra = dMillTotLen - dMillLen
if Proc.Box:getMin():getZ() - dMillExtra < b3Raw:getMin():getZ() - 10 * GEO.EPS_SMALL then if Proc.Box:getMin():getZ() - dMillExtra < b3Raw:getMin():getZ() - 10 * GEO.EPS_SMALL then
local sErr = 'Error : Tool collide with table' local sErr = 'Error : Tool collide with table'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr, true
end end
-- inserisco la lavorazione di contornatura -- inserisco la lavorazione di contornatura
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -1690,13 +1704,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
dExtraLongEnd = 0 dExtraLongEnd = 0
end end
-- se ho abilitato la lavorazione di fresatura per garantire passaggio gambo utensile, inserisco la lavorazione -- se ho abilitato la lavorazione di fresatura per garantire passaggio gambo utensile, inserisco la lavorazione
local bThroughRaw = false
if bEnablePreMill then if bEnablePreMill then
-- verifico se feature e' passante
if ((Proc.Box:getMin():getX() < ( b3Raw:getMin():getX() + 50)) and (Proc.Box:getMax():getX() > ( b3Raw:getMax():getX() - 50))) or
((Proc.Box:getMin():getY() < ( b3Raw:getMin():getY() + 50)) and (Proc.Box:getMax():getY() > ( b3Raw:getMax():getY() - 50))) then
bThroughRaw = true
end
-- recupero la lavorazione di taglio -- recupero la lavorazione di taglio
local sCuttingGorge = WM.FindCutting( 'Standard') local sCuttingGorge = WM.FindCutting( 'Standard')
@@ -1744,7 +1752,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
local bSawInvertSE = false local bSawInvertSE = false
-- se non passante, aggiungo fresatura area della fresa -- se non passante, aggiungo fresatura area della fresa
if not bThroughRaw and nNumStep - 1 > 0 then if not Proc.IsThrough and nNumStep - 1 > 0 then
local SquareId -- Id della composita da fresare local SquareId -- Id della composita da fresare
local dSawShortening = sqrt( b3Raw:getDimZ() * ( dSawDiam - b3Raw:getDimZ())) -- da calcolare in base a raggio lama e spessore grezzo local dSawShortening = sqrt( b3Raw:getDimZ() * ( dSawDiam - b3Raw:getDimZ())) -- da calcolare in base a raggio lama e spessore grezzo
-- gruppo ausiliario -- gruppo ausiliario
@@ -2014,6 +2022,10 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
local nStep = ceil( ( dThick - dMaxMat) / dStep) local nStep = ceil( ( dThick - dMaxMat) / dStep)
dStep = max( ( dThick - dMaxMat) / max( nStep, 1), 0) dStep = max( ( dThick - dMaxMat) / max( nStep, 1), 0)
local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0) local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0)
-- tasca aperta sopra non necessita di MaxElev
if Proc.Fct == 2 and Proc.AffectedFaces.Top then
dMaxElev = nil
end
if nSinglePass and nSinglePass > 0 then if nSinglePass and nSinglePass > 0 then
dStep = 0 dStep = 0
if nSinglePass == 1 then if nSinglePass == 1 then
@@ -2027,7 +2039,9 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
-- leggo eventuali note esistenti della lavorazione -- leggo eventuali note esistenti della lavorazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
-- aggiungo alle note massima elevazione -- aggiungo alle note massima elevazione
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 3)) if dMaxElev then
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 3))
end
-- se lavorazione in doppio aggiungo le rispettive note -- se lavorazione in doppio aggiungo le rispettive note
if Proc.Double and Proc.Double == 2 then if Proc.Double and Proc.Double == 2 then
sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double) sUserNotes = EgtSetValInNotes( sUserNotes, 'DOUBLE', Proc.Double)
@@ -2101,15 +2115,9 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
-- setto allungamenti iniziali e finali -- setto allungamenti iniziali e finali
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
-- se ho passate orizzontali riduco l'eventuale allungamento settato dall'utente -- tutte le passate partono dalla stessa distanza
local dLiPerp = EgtGetMachiningParam( MCH_MP.LIPERP) local dLiPerp = dElev + WD.CUT_SIC - dRadialOffset
local dLoPerp = EgtGetMachiningParam( MCH_MP.LOPERP) local dLoPerp = dElev + WD.CUT_SIC - dRadialOffset
if dLiPerp > 0 then
dLiPerp = dLiPerp - dRadialOffset
end
if dLoPerp > 0 then
dLoPerp = dLoPerp - dRadialOffset
end
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp) EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp) EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
-- se richiesto, setto la nota per spostare la lavorazione alla fine -- se richiesto, setto la nota per spostare la lavorazione alla fine
@@ -2280,6 +2288,10 @@ local function VerifyPocket( Proc, nFacet, dElev, nRawId)
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT) local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
local dStartDiameter = min( dH, dV) local dStartDiameter = min( dH, dV)
local dMaxDiameter = dStartDiameter local dMaxDiameter = dStartDiameter
-- se tasca chiusa si riduce il massimo diametro per evitare che la svuotatura fallisca
if Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' then
dMaxDiameter = 0.9 * dStartDiameter
end
-- se una sola faccia posso usare un utensile più grande della faccia -- se una sola faccia posso usare un utensile più grande della faccia
if Proc.Fct == 1 then if Proc.Fct == 1 then
dMaxDiameter = 2 * dMaxDiameter dMaxDiameter = 2 * dMaxDiameter
@@ -2287,7 +2299,12 @@ local function VerifyPocket( Proc, nFacet, dElev, nRawId)
-- se forma ad L posso usare un utensile più grande della faccia -- se forma ad L posso usare un utensile più grande della faccia
local bIsL = ( Proc.Fct == 2 or WL.TestElleShape3( Proc.Id, Proc.Fct) or WL.TestElleShape4( Proc.Id, Proc.Fct) == 2) local bIsL = ( Proc.Fct == 2 or WL.TestElleShape3( Proc.Id, Proc.Fct) or WL.TestElleShape4( Proc.Id, Proc.Fct) == 2)
if bIsL then if bIsL then
dMaxDiameter = 2 * dMaxDiameter if Proc.Fct < 4 then
dMaxDiameter = 2 * dMaxDiameter
-- per tasche chiuse l'utensile non può essere più grande del lato più grande
else
dMaxDiameter = min( 2 * dMaxDiameter, max( dH, dV))
end
end end
-- se forma ad U riduco il diametro se necessario -- se forma ad U riduco il diametro se necessario
local bIsU = ( Proc.Fct == 3 and not WL.TestElleShape3( Proc.Id, Proc.Fct)) local bIsU = ( Proc.Fct == 3 and not WL.TestElleShape3( Proc.Id, Proc.Fct))
@@ -2381,7 +2398,7 @@ local function VerifyPocket( Proc, nFacet, dElev, nRawId)
-- se tasca chiusa cerco lavorazione con diametro massimo pari a dimensione tasca e riverifico per eventuale doppio -- se tasca chiusa cerco lavorazione con diametro massimo pari a dimensione tasca e riverifico per eventuale doppio
if bForceClosedPocket then if bForceClosedPocket then
dMaxDiameter = dStartDiameter dMaxDiameter = 0.9 * dStartDiameter
bUseDElevToFindPocketing = true bUseDElevToFindPocketing = true
sPocketing = WM.FindPocketing( 'Pocket', dMaxDiameter, dElev, nil, nil, bExcludeNoTipFeed, dDistanceToNearestPart) sPocketing = WM.FindPocketing( 'Pocket', dMaxDiameter, dElev, nil, nil, bExcludeNoTipFeed, dDistanceToNearestPart)
if not sPocketing then if not sPocketing then
@@ -2510,6 +2527,40 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
return true, sWarn, sTuuid return true, sWarn, sTuuid
end end
---------------------------------------------------------------------
local function MakeOneFaceByBlade( Proc, sCutting, idFace)
-- inserisco la lavorazione
local sName = 'Cut_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId)) .. '_' .. tostring( Proc.Id) .. '_' .. tostring( i)
local nMchId = WM.AddMachining( Proc, sName, sCutting)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sCutting
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchId, 'Part', Proc.PartId)
-- aggiungo geometria
EgtSetMachiningGeometry( { { Proc.Id, idFace}})
-- percorso da non invertire
EgtSetMachiningParam( MCH_MP.INVERT, false)
-- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, 0)
-- assegno il lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- assegno l'attacco e l'uscita
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
-- nessun criterio per il braccio è necessario
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.NONE)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
return true
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function MakeOneFace( Proc, nRawId, b3Raw) local function MakeOneFace( Proc, nRawId, b3Raw)
-- dati della faccia -- dati della faccia
@@ -2590,7 +2641,7 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
-- recupero la lavorazione di taglio con lama e i suoi parametri -- recupero la lavorazione di taglio con lama e i suoi parametri
local sCutting, dSawDiam, dSawThick, dSawMaxDepth = WM.FindCutting( 'Standard') local sCutting, dSawDiam, dSawThick, dSawMaxDepth = WM.FindCutting( 'Standard')
-- se parametro Q abilita lavorazione ribasso con fresa di fianco -- se parametro Q abilita lavorazione ribasso con fresa di fianco
local _, nUseMillOnSide = EvaluateQParam( Proc) local _, nUseMillOnSide, nUseBlade = EvaluateQParam( Proc)
local dMaxZVers, dMinZVers local dMaxZVers, dMinZVers
if nUseMillOnSide >= 1 then if nUseMillOnSide >= 1 then
dMaxZVers = 0.866 dMaxZVers = 0.866
@@ -2631,183 +2682,184 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
dMaxZVers = 0.95 dMaxZVers = 0.95
dMinZVers = 0.1 dMinZVers = 0.1
end end
-- se di fianco in basso if nUseBlade == 0 then
if vtN[1]:getZ() < -dMaxZVers or vtN[2]:getZ() < -dMaxZVers then if vtN[1]:getZ() < -dMaxZVers or vtN[2]:getZ() < -dMaxZVers then
-- cerco la faccia verticale o quasi -- cerco la faccia verticale o quasi
local nFacet = EgtIf( abs( vtN[1]:getZ()) < dMinZVers, 0, 1) local nFacet = EgtIf( abs( vtN[1]:getZ()) < dMinZVers, 0, 1)
-- cerco nei parametri utensili la nota di affondamento di fianco SIDEDEPTH -- cerco nei parametri utensili la nota di affondamento di fianco SIDEDEPTH
local dMaxDepthOnSide = 0 local dMaxDepthOnSide = 0
local dMillDiam = 0 local dMillDiam = 0
local dMillDiamTh = 0 local dMillDiamTh = 0
if bEnableMillOnSide and EgtMdbSetCurrMachining( sMillOnSide) then if bEnableMillOnSide and EgtMdbSetCurrMachining( sMillOnSide) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or dMaxDepthOnSide dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or dMaxDepthOnSide
dMaxDepthOnSide = min( dMaxDepthOnSide, 0.5 * ( dMillDiam - dMillDiamTh)) dMaxDepthOnSide = min( dMaxDepthOnSide, 0.5 * ( dMillDiam - dMillDiamTh))
end
end
local dMaxDist = 300
if bEnableMillOnSide and dMaxDepthOnSide > 0 then
dMaxDist = dMaxDepthOnSide
end
-- se vicino al bordo del grezzo e non troppo larga, provo con fresatura di fianco
local ptMid = ( ptP1 + ptP2) / 2
local bMakeFirstGroove
local bMachFromDn = true
local bInsertMach
local dSideDist
-- per evitare errori in casi di pezzi molto stretti, verifico le distanze in base alla direzione della faccia
-- se normale verso X
if vtN[nFacet+1]:getX() > 0.99 then
dSideDist = abs( ptMid:getX() - b3Raw:getMax():getX())
-- altrimenti se normale verso X-
elseif vtN[nFacet+1]:getX() < -0.99 then
dSideDist = abs( ptMid:getX() - b3Raw:getMin():getX())
-- altrimenti se normale verso Y+
elseif vtN[nFacet+1]:getY() > 0.99 then
dSideDist = abs( ptMid:getY() - b3Raw:getMax():getY())
-- altrimenti se normale verso Y-
elseif vtN[nFacet+1]:getY() < -0.99 then
dSideDist = abs( ptMid:getY() - b3Raw:getMin():getY())
end
if dSideDist and dSideDist < dMaxDist then
bInsertMach = true
bMakeFirstGroove = false
-- altrimenti la distanza è maggiore e se è sempre abilitata la lavorazione MillOnSide
elseif bEnableMillOnSide and dMaxDepthOnSide then
bInsertMach = true
bMakeFirstGroove = true
end
-- se posso eseguire la lavorazione per distanza inferiore utensile o lavorazione preceduta da sgossatura gola
if bInsertMach then
return MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, nil, nil, nil, bDoubleMillOnSide)
else
local sErr = 'Error feature not machinable (dimensions)'
EgtOutLog( sErr)
return false, sErr
end
-- se altrimenti di fianco in alto
elseif vtN[1]:getZ() > dMaxZVers or vtN[2]:getZ() > dMaxZVers then
-- cerco la faccia con il maggior numero di adiacenze (e minor elevazione)
local nFacInd, _, nFacInd2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
if nFacInd == -2 then
local sErr = 'Error feature with 2 faces with undercut'
EgtOutLog( sErr)
return false, sErr
end
local vtNTemp = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
local dSideDist
local ptMid = ( ptP1 + ptP2) / 2
-- faccia orizzontale
local nFacet = EgtIf( vtNTemp:getZ() >= WD.NZ_MINA, nFacInd, nFacInd2)
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacet, GDB_ID.ROOT)
-- faccia verticale
local nFacetVert = EgtIf( nFacet == nFacInd, nFacInd2, nFacInd)
local vtNV = EgtSurfTmFacetNormVersor( Proc.Id, nFacetVert, GDB_ID.ROOT)
-- per evitare errori in casi di pezzi molto stretti, verifico le distanze in base alla direzione della faccia
-- local dSideDist = min( abs( ptMid:getX() - b3Raw:getMin():getX()), abs( ptMid:getX() - b3Raw:getMax():getX()),
-- abs( ptMid:getY() - b3Raw:getMin():getY()), abs( ptMid:getY() - b3Raw:getMax():getY()))
-- se normale verso X
if vtNV:getX() > 0.99 then
dSideDist = abs( ptMid:getX() - b3Raw:getMax():getX())
-- altrimenti se normale verso X-
elseif vtNV:getX() < -0.99 then
dSideDist = abs( ptMid:getX() - b3Raw:getMin():getX())
-- altrimenti se normale verso Y+
elseif vtNV:getY() > 0.99 then
dSideDist = abs( ptMid:getY() - b3Raw:getMax():getY())
-- altrimenti se normale verso Y-
elseif vtNV:getY() < -0.99 then
dSideDist = abs( ptMid:getY() - b3Raw:getMin():getY())
end
-- cerco nei parametri utensili la nota di affondamento di fianco SIDEDEPTH
local dMaxDepthOnSide = 0
local dMillDiam = 0
if bEnableMillOnSide and EgtMdbSetCurrMachining( sMillOnSide) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or dMaxDepthOnSide
end
end
-- 2021.10.08 E.S. in base a richieste del cliente:
-- Se parametro Q riduce utilizzo lavorazione di lato come lama ed elevazione laterale supera il 60% diametro utensile
-- disabilito
if nUseMillOnSide == 2 and dSideDist > 0.6 * dMillDiam then
bEnableMillOnSide = false
end
-- per il fianco in alto non ci sono problemi di inserimento massimo laterale, setto la variabile pari al raggio utensile - 1mm
dMaxDepthOnSide = ( 0.5 * dMillDiam) - 1
local dMaxDist = 300
if bEnableMillOnSide and dMaxDepthOnSide > 0 then
dMaxDist = dMaxDepthOnSide
end
-- se vicino al bordo del grezzo e non troppo larga, provo con fresatura di fianco
local bMakeFirstGroove = false
local bLikeAsMakeFirstGroove
local bMachFromDn = false
local bInsertMach
if dSideDist and dSideDist < dMaxDist then
-- se abilitata SideMill oppure se la specchiata guarda in basso e quindi l'attacco deve essere a filo
if ( bEnableMillOnSide and dMaxDepthOnSide > 0) or ( Proc.Double == 2 and Proc.MirrorDeltaZ and abs( Proc.MirrorDeltaZ) > GEO.EPS_SMALL) then
bLikeAsMakeFirstGroove = false
return MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove, nil, nil, bDoubleMillOnSide)
else
local bOk, sErr, bSideMachiningNotFound = MakeByMill( Proc, nFacet, 1 - nFacet, nRawId, b3Raw, dSideDist)
if not bOk and bSideMachiningNotFound then
bOk, sErr = MakeByPocketing( Proc, nFacet, nRawId, b3Raw)
end end
end
local dMaxDist = 300
if bEnableMillOnSide and dMaxDepthOnSide > 0 then
dMaxDist = dMaxDepthOnSide
end
-- se vicino al bordo del grezzo e non troppo larga, provo con fresatura di fianco
local ptMid = ( ptP1 + ptP2) / 2
local bMakeFirstGroove
local bMachFromDn = true
local bInsertMach
local dSideDist
-- per evitare errori in casi di pezzi molto stretti, verifico le distanze in base alla direzione della faccia
-- se normale verso X
if vtN[nFacet+1]:getX() > 0.99 then
dSideDist = abs( ptMid:getX() - b3Raw:getMax():getX())
-- altrimenti se normale verso X-
elseif vtN[nFacet+1]:getX() < -0.99 then
dSideDist = abs( ptMid:getX() - b3Raw:getMin():getX())
-- altrimenti se normale verso Y+
elseif vtN[nFacet+1]:getY() > 0.99 then
dSideDist = abs( ptMid:getY() - b3Raw:getMax():getY())
-- altrimenti se normale verso Y-
elseif vtN[nFacet+1]:getY() < -0.99 then
dSideDist = abs( ptMid:getY() - b3Raw:getMin():getY())
end
if dSideDist and dSideDist < dMaxDist then
bInsertMach = true
bMakeFirstGroove = false
-- altrimenti la distanza è maggiore e se è sempre abilitata la lavorazione MillOnSide
elseif bEnableMillOnSide and dMaxDepthOnSide then
bInsertMach = true
bMakeFirstGroove = true
end
-- se posso eseguire la lavorazione per distanza inferiore utensile o lavorazione preceduta da sgossatura gola
if bInsertMach then
return MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, nil, nil, nil, bDoubleMillOnSide)
else
local sErr = 'Error feature not machinable (dimensions)'
EgtOutLog( sErr)
return false, sErr
end
-- se altrimenti di fianco in alto
elseif vtN[1]:getZ() > dMaxZVers or vtN[2]:getZ() > dMaxZVers then
-- cerco la faccia con il maggior numero di adiacenze (e minor elevazione)
local nFacInd, _, nFacInd2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
if nFacInd == -2 then
local sErr = 'Error feature with 2 faces with undercut'
EgtOutLog( sErr)
return false, sErr
end
local vtNTemp = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
local dSideDist
local ptMid = ( ptP1 + ptP2) / 2
-- faccia orizzontale
local nFacet = EgtIf( vtNTemp:getZ() >= WD.NZ_MINA, nFacInd, nFacInd2)
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacet, GDB_ID.ROOT)
-- faccia verticale
local nFacetVert = EgtIf( nFacet == nFacInd, nFacInd2, nFacInd)
local vtNV = EgtSurfTmFacetNormVersor( Proc.Id, nFacetVert, GDB_ID.ROOT)
-- per evitare errori in casi di pezzi molto stretti, verifico le distanze in base alla direzione della faccia
-- local dSideDist = min( abs( ptMid:getX() - b3Raw:getMin():getX()), abs( ptMid:getX() - b3Raw:getMax():getX()),
-- abs( ptMid:getY() - b3Raw:getMin():getY()), abs( ptMid:getY() - b3Raw:getMax():getY()))
-- se normale verso X
if vtNV:getX() > 0.99 then
dSideDist = abs( ptMid:getX() - b3Raw:getMax():getX())
-- altrimenti se normale verso X-
elseif vtNV:getX() < -0.99 then
dSideDist = abs( ptMid:getX() - b3Raw:getMin():getX())
-- altrimenti se normale verso Y+
elseif vtNV:getY() > 0.99 then
dSideDist = abs( ptMid:getY() - b3Raw:getMax():getY())
-- altrimenti se normale verso Y-
elseif vtNV:getY() < -0.99 then
dSideDist = abs( ptMid:getY() - b3Raw:getMin():getY())
end
-- cerco nei parametri utensili la nota di affondamento di fianco SIDEDEPTH
local dMaxDepthOnSide = 0
local dMillDiam = 0
if bEnableMillOnSide and EgtMdbSetCurrMachining( sMillOnSide) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or dMaxDepthOnSide
end
end
-- 2021.10.08 E.S. in base a richieste del cliente:
-- Se parametro Q riduce utilizzo lavorazione di lato come lama ed elevazione laterale supera il 60% diametro utensile
-- disabilito
if nUseMillOnSide == 2 and dSideDist > 0.6 * dMillDiam then
bEnableMillOnSide = false
end
-- per il fianco in alto non ci sono problemi di inserimento massimo laterale, setto la variabile pari al raggio utensile - 1mm
dMaxDepthOnSide = ( 0.5 * dMillDiam) - 1
local dMaxDist = 300
if bEnableMillOnSide and dMaxDepthOnSide > 0 then
dMaxDist = dMaxDepthOnSide
end
-- se vicino al bordo del grezzo e non troppo larga, provo con fresatura di fianco
local bMakeFirstGroove = false
local bLikeAsMakeFirstGroove
local bMachFromDn = false
local bInsertMach
if dSideDist and dSideDist < dMaxDist then
-- se abilitata SideMill oppure se la specchiata guarda in basso e quindi l'attacco deve essere a filo
if ( bEnableMillOnSide and dMaxDepthOnSide > 0) or ( Proc.Double == 2 and Proc.MirrorDeltaZ and abs( Proc.MirrorDeltaZ) > GEO.EPS_SMALL) then
bLikeAsMakeFirstGroove = false
return MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove, nil, nil, bDoubleMillOnSide)
else
local bOk, sErr, bSideMachiningNotFound = MakeByMill( Proc, nFacet, 1 - nFacet, nRawId, b3Raw, dSideDist)
if not bOk and bSideMachiningNotFound then
bOk, sErr = MakeByPocketing( Proc, nFacet, nRawId, b3Raw)
end
-- se angolo ottuso riprendo il lato quasi verticale
if bOk and dAng and dAng > -90 + 10 * GEO.EPS_SMALL then
local bOk2, sErr2 = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, false, nil, true)
end
return bOk, sErr
end
elseif bEnableMillOnSide and dMaxDepthOnSide > 0 then
bLikeAsMakeFirstGroove = true
local bOk, sErr = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove, nil, nil, bDoubleMillOnSide)
if bOk then return true end
end
-- se non inclinate o capacità di taglio non sufficiente o non molto grandi (80mm), provo con contornatura o svuotatura
if vtN:getZ() > 0.866 or vtNV:getZ() > 0.866 or not sCutting or dSawMaxDepth < dDimY[1] + WD.CUT_SIC or dSawMaxDepth < dDimY[2] + WD.CUT_SIC or dDimY[1] < 80 or dDimY[2] < 80 then
-- eseguo la svuotatura
local bOk, sErr, sTuuid = MakeByPocketing( Proc, nFacet, nRawId, b3Raw)
-- se angolo ottuso riprendo il lato quasi verticale -- se angolo ottuso riprendo il lato quasi verticale
if bOk and dAng and dAng > -90 + 10 * GEO.EPS_SMALL then if bOk and dAng and dAng > -90 + 10 * GEO.EPS_SMALL then
local bOk2, sErr2 = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, false, nil, true) local _, dHVert, dVVert = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacetVert, GDB_ID.ROOT)
local dDepth = min( dHVert, dVVert)
local _, dHHor, dVHor = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
local dDiam = 2 * min( dHHor, dVHor)
local sMillObtuseAngle = WM.FindMilling( 'FreeContour', dDepth, sTuuid, nil, dDiam, nil, nil, nil)
if not sMillObtuseAngle then
sMillObtuseAngle = WM.FindMilling( 'FreeContour', dDepth, nil, nil, dDiam, nil, nil, nil)
end
if not sMillObtuseAngle then
local sErrMillNotFound = 'Error : Processing to finish obtuse angle not found in library'
EgtOutLog( sErrMillNotFound)
return true, sErrMillNotFound
end
local bOk2, sErr2 = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, sMillObtuseAngle, dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, false, nil, true)
end end
return bOk, sErr return bOk, sErr
end end
elseif bEnableMillOnSide and dMaxDepthOnSide > 0 then -- se una delle due facce rivolta verso il basso
bLikeAsMakeFirstGroove = true elseif vtN[1]:getZ() < -0.001 or vtN[2]:getZ() < -0.001 then
local bOk, sErr = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove, nil, nil, bDoubleMillOnSide) -- cerco la faccia rivolta verso l'alto
if bOk then return true end local nFacet
end if vtN[1]:getZ() > 0 then
-- se non inclinate o capacità di taglio non sufficiente o non molto grandi (80mm), provo con contornatura o svuotatura nFacet = 0
if vtN:getZ() > 0.866 or vtNV:getZ() > 0.866 or not sCutting or dSawMaxDepth < dDimY[1] + WD.CUT_SIC or dSawMaxDepth < dDimY[2] + WD.CUT_SIC or dDimY[1] < 80 or dDimY[2] < 80 then elseif vtN[2]:getZ() > 0 then
-- eseguo la svuotatura nFacet = 1
local bOk, sErr, sTuuid = MakeByPocketing( Proc, nFacet, nRawId, b3Raw) else
-- se angolo ottuso riprendo il lato quasi verticale local sErr = 'Error feature with 2 faces facing down'
if bOk and dAng and dAng > -90 + 10 * GEO.EPS_SMALL then EgtOutLog( sErr)
local _, dHVert, dVVert = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacetVert, GDB_ID.ROOT) return false, sErr
local dDepth = min( dHVert, dVVert)
local _, dHHor, dVHor = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
local dDiam = 2 * min( dHHor, dVHor)
local sMillObtuseAngle = WM.FindMilling( 'FreeContour', dDepth, sTuuid, nil, dDiam, nil, nil, nil)
if not sMillObtuseAngle then
sMillObtuseAngle = WM.FindMilling( 'FreeContour', dDepth, nil, nil, dDiam, nil, nil, nil)
end
if not sMillObtuseAngle then
local sErrMillNotFound = 'Error : Processing to finish obtuse angle not found in library'
EgtOutLog( sErrMillNotFound)
return true, sErrMillNotFound
end
local bOk2, sErr2 = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, sMillObtuseAngle, dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, false, nil, true)
end end
return bOk, sErr -- eseguo la svuotatura
return MakeByPocketing( Proc, nFacet, nRawId, b3Raw)
end end
-- se una delle due facce rivolta verso il basso
elseif vtN[1]:getZ() < -0.001 or vtN[2]:getZ() < -0.001 then
-- cerco la faccia rivolta verso l'alto
local nFacet
if vtN[1]:getZ() > 0 then
nFacet = 0
elseif vtN[2]:getZ() > 0 then
nFacet = 1
else
local sErr = 'Error feature with 2 faces facing down'
EgtOutLog( sErr)
return false, sErr
end
-- eseguo la svuotatura
return MakeByPocketing( Proc, nFacet, nRawId, b3Raw)
end end
-- ordino i tagli per fare prima quello meno inclinato -- ordino i tagli per fare prima quello meno inclinato
local nOrd = { 0, 1} local nOrd = { 0, 1}
@@ -2815,37 +2867,15 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
nOrd = { 1, 0} nOrd = { 1, 0}
end end
-- eseguo i tagli di lama -- eseguo i tagli di lama
local bOk, sErr
for i = 1, 2 do for i = 1, 2 do
-- inserisco la lavorazione bOk, sErr = MakeOneFaceByBlade( Proc, sCutting, nOrd[i])
local sName = 'Cut_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId)) .. '_' .. tostring( Proc.Id) .. '_' .. tostring( i) if not bOk then
local nMchId = WM.AddMachining( Proc, sName, sCutting) return bOk, sErr
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sCutting
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchId, 'Part', Proc.PartId)
-- aggiungo geometria
EgtSetMachiningGeometry( { { Proc.Id, nOrd[i]}})
-- percorso da non invertire
EgtSetMachiningParam( MCH_MP.INVERT, false)
-- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, 0)
-- assegno il lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- assegno l'attacco e l'uscita
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
-- nessun criterio per il braccio è necessario
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.NONE)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end end
end end
return true
return bOk, sErr
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -2862,8 +2892,8 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
end end
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT) local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
local dMaxSlotThicknessForBlade = 25 local dMaxSlotThicknessForBlade = 19
local bIsSmallSlot = ( Proc.Fct == 3 and ( min( dH, dV) < dMaxSlotThicknessForBlade - 10 * GEO.EPS_SMALL) and vtN:getZ() > -0.01) local bIsSmallSlot = ( Proc.Fct == 3 and ( min( dH, dV) < dMaxSlotThicknessForBlade - 10 * GEO.EPS_SMALL) and ( vtN:getZ() > -0.01) and ( vtN:getZ() < 0.5))
-- se di fianco -- se di fianco
if not bPckt and Proc.Fct >= 3 and ( ( vtN:getZ() < WD.NZ_MINA) or bIsSmallSlot) then if not bPckt and Proc.Fct >= 3 and ( ( vtN:getZ() < WD.NZ_MINA) or bIsSmallSlot) then
-- recupero elevazione faccia in feature -- recupero elevazione faccia in feature
@@ -2885,13 +2915,15 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
-- se ho abilitata lavorazione di fresa di fianco -- se ho abilitata lavorazione di fresa di fianco
if Proc.Fct >= 3 and sMillOnSide and nUseMillOnSide >= 1 and not bIsSmallSlot then if Proc.Fct >= 3 and sMillOnSide and nUseMillOnSide >= 1 and not bIsSmallSlot then
-- cerco nei parametri utensili la nota di affondamento di fianco SIDEDEPTH -- cerco nei parametri utensili la nota di affondamento di fianco SIDEDEPTH
local dMaxDepthOnSide = 0 local dMaxDepthOnSide = 999
local dMillDiam = 0 local dMillDiam = 0
local dMillDiamTh = EgtTdbGetCurrToolThDiam() or 60
if EgtMdbSetCurrMachining( sMillOnSide) then if EgtMdbSetCurrMachining( sMillOnSide) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or dMaxDepthOnSide dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh
dMaxDepthOnSide = min( EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or dMaxDepthOnSide, 0.5 * ( dMillDiam - dMillDiamTh))
end end
end end
local bMakeFirstGroove local bMakeFirstGroove
@@ -2980,7 +3012,7 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
else else
local sErr = 'Side milling not possible' local sErr = 'Side milling not possible'
EgtOutLog( sErr) EgtOutLog( sErr)
return true, sErr return false, sErr
end end
-- fessura verticale -- fessura verticale
elseif Proc.Stype == 3 then elseif Proc.Stype == 3 then
+230 -36
View File
@@ -9,6 +9,7 @@
-- In Collect aggiunto il recupero preliminare di varie informazioni sulla feature. -- In Collect aggiunto il recupero preliminare di varie informazioni sulla feature.
-- 2023/12/11 In ClassifyTopology si passa ora anche l'Id del grezzo (allineamento Topology con Beam). -- 2023/12/11 In ClassifyTopology si passa ora anche l'Id del grezzo (allineamento Topology con Beam).
-- 2024/02/20 Aggiunta gestione DeltaX/Y/Z del pannello dall'origine da BTL. -- 2024/02/20 Aggiunta gestione DeltaX/Y/Z del pannello dall'origine da BTL.
-- 2024/08/30 Aggiunta nota altezza sottopezzo, per pareti a layer
-- Tabella per definizione modulo -- Tabella per definizione modulo
local WallExec = {} local WallExec = {}
@@ -44,6 +45,7 @@ _G.package.loaded.WProcessVariant = nil
local WM = require( 'WMachiningLib') local WM = require( 'WMachiningLib')
local WL = require( 'WallLib') local WL = require( 'WallLib')
local Topology = require( 'WFeatureTopology') local Topology = require( 'WFeatureTopology')
local Squaring = require( 'Squaring')
local Cut = require( 'WProcessCut') local Cut = require( 'WProcessCut')
local DoubleCut = require( 'WProcessDoubleCut') local DoubleCut = require( 'WProcessDoubleCut')
local SawCut = require( 'WProcessSawCut') local SawCut = require( 'WProcessSawCut')
@@ -56,30 +58,13 @@ local Text = require( 'WProcessText')
local FreeContour = require( 'WProcessFreeContour') local FreeContour = require( 'WProcessFreeContour')
local Variant = require( 'WProcessVariant') local Variant = require( 'WProcessVariant')
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle pareti nel pannello *** -- *** Inserimento delle pareti nel pannello ***
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewProcess, nRawOutlineId) local function GetRawOrigAndDeltas()
-- Creazione nuovo gruppo di lavoro
if not bMachGroupOk then
local sMgName = EgtGetMachGroupNewName( 'Mach')
local NewMgId = EgtAddMachGroup( sMgName)
if not NewMgId then
local sOut = 'Errore nella creazione del gruppo di lavoro ' .. sMgName
return false, sOut
end
end
-- Impostazione della tavola
EgtSetTable( 'Tab')
-- Area tavola -- Area tavola
local b3Tab = EgtGetTableArea() local b3Tab = EgtGetTableArea()
-- Calcolo posizione estremo di riferimento della tavola rispetto a sua origine in BL -- Calcolo posizione estremo di riferimento della tavola rispetto a sua origine in BL
local OrigOnTab
local nCorner
local sOrigCorner = WD.ORIG_CORNER or 'BR' local sOrigCorner = WD.ORIG_CORNER or 'BR'
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
if WD.GetOrigCorner then if WD.GetOrigCorner then
@@ -94,6 +79,8 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr
local DeltaY = EgtIf( dDeltaYFromBtl > 0, dDeltaYFromBtl, WD.DELTA_Y or 0) local DeltaY = EgtIf( dDeltaYFromBtl > 0, dDeltaYFromBtl, WD.DELTA_Y or 0)
local DeltaZ = EgtIf( dDeltaZFromBtl > 0, dDeltaZFromBtl, WD.DELTA_Z or 0) local DeltaZ = EgtIf( dDeltaZFromBtl > 0, dDeltaZFromBtl, WD.DELTA_Z or 0)
local nCorner
local OrigOnTab
if sOrigCorner == 'TL' then if sOrigCorner == 'TL' then
nCorner = MCH_CR.TL nCorner = MCH_CR.TL
OrigOnTab = Point3d( 0 + abs( DeltaX), b3Tab:getDimY() - abs( DeltaY), DeltaZ) OrigOnTab = Point3d( 0 + abs( DeltaX), b3Tab:getDimY() - abs( DeltaY), DeltaZ)
@@ -119,6 +106,28 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr
nCorner = MCH_CR.BL nCorner = MCH_CR.BL
OrigOnTab = Point3d( WD.NEW_REF + abs( DeltaX), abs( DeltaY), DeltaZ) OrigOnTab = Point3d( WD.NEW_REF + abs( DeltaX), abs( DeltaY), DeltaZ)
end end
return sOrigCorner, nCorner, OrigOnTab
end
-------------------------------------------------------------------------------------------------------------
function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewProcess, nRawOutlineId)
-- Creazione nuovo gruppo di lavoro
if not bMachGroupOk then
local sMgName = EgtGetMachGroupNewName( 'Mach')
local NewMgId = EgtAddMachGroup( sMgName)
if not NewMgId then
local sOut = 'Errore nella creazione del gruppo di lavoro ' .. sMgName
return false, sOut
end
end
-- Impostazione della tavola
EgtSetTable( 'Tab')
-- Recupero dati posizionamento grezzo
local sOrigCorner, nCorner, OrigOnTab = GetRawOrigAndDeltas()
-- Impostazione dell'attrezzaggio di default -- Impostazione dell'attrezzaggio di default
EgtImportSetup() EgtImportSetup()
-- Impostazione eventuale allargamento area disponibile per grezzo -- Impostazione eventuale allargamento area disponibile per grezzo
@@ -131,6 +140,7 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr
nRaw = EgtAddRawPart( Point3d( 0, 0, 0), dRawL, dRawW, dRawH, WD.RAWCOL) nRaw = EgtAddRawPart( Point3d( 0, 0, 0), dRawL, dRawW, dRawH, WD.RAWCOL)
end end
EgtMoveToCornerRawPart( nRaw, OrigOnTab, nCorner) EgtMoveToCornerRawPart( nRaw, OrigOnTab, nCorner)
EgtSetInfo( nRaw, 'ORIGCORNER', sOrigCorner)
EgtSetInfo( nRaw, 'ORD', 1) EgtSetInfo( nRaw, 'ORD', 1)
-- Inserimento dei pezzi nel grezzo -- Inserimento dei pezzi nel grezzo
for i = 1, #vWall do for i = 1, #vWall do
@@ -165,6 +175,7 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr
end end
else else
local dPosH = EgtIf( vWall[i].PosY < 0.1, ( dRawH - PartHeight) / 2, vWall[i].PosY) local dPosH = EgtIf( vWall[i].PosY < 0.1, ( dRawH - PartHeight) / 2, vWall[i].PosY)
EgtSetInfo( nRaw, 'SUBPIECE', dPosH)
ptPos = Point3d( dRawL - vWall[i].PosX - PartLen, vWall[i].PosZ, dPosH) + vtOffs ptPos = Point3d( dRawL - vWall[i].PosX - PartLen, vWall[i].PosZ, dPosH) + vtOffs
end end
EgtAddPartToRawPart( Pz, ptPos, nRaw) EgtAddPartToRawPart( Pz, ptPos, nRaw)
@@ -172,10 +183,27 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr
return true return true
end end
-------------------------------------------------------------------------------------------------------------
function WallExec.MoveRaw()
-- Recupero dati posizionamento grezzo
local sOrigCorner, nCorner, OrigOnTab = GetRawOrigAndDeltas()
-- Recupero identificativo del grezzo
local nRaw = EgtGetFirstRawPart() or GDB_ID.NULL
-- Posizione iniziale del centro grezzo
local ptOriCen = EgtGetRawPartCenter( nRaw)
-- Sposto il grezzo
EgtMoveToCornerRawPart( nRaw, OrigOnTab, nCorner)
EgtSetInfo( nRaw, 'ORIGCORNER', sOrigCorner)
-- Posizione finale del centro grezzo
local ptNewCen = EgtGetRawPartCenter( nRaw)
-- Restituisco flag di movimento
return not AreSamePointApprox( ptOriCen, ptNewCen)
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle lavorazioni nelle pareti *** -- *** Inserimento delle lavorazioni nelle pareti ***
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function WallExec.CollectFeatures( PartId, b3Raw) function WallExec.CollectFeatures( PartId, b3Raw, b3Squaring)
-- recupero le feature -- recupero le feature
local vProc = {} local vProc = {}
local LayerId = {} local LayerId = {}
@@ -216,12 +244,22 @@ function WallExec.CollectFeatures( PartId, b3Raw)
Proc.DistanceToRawPart = WL.GetProcessDistanceToRawPart( Proc, b3Raw) Proc.DistanceToRawPart = WL.GetProcessDistanceToRawPart( Proc, b3Raw)
-- recupero informazioni sulle facce della feature -- recupero informazioni sulle facce della feature
Proc.Face = {} Proc.Face = {}
for i = 1, Proc.Fct do if Proc.Fct < 50 then
Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT ), Elevation = WL.GetFaceElevation( Proc.Id, i - 1, PartId)} for i = 1, Proc.Fct do
Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT ), Elevation = WL.GetFaceElevation( Proc.Id, i - 1, PartId)}
end
end end
end end
if Proc.Box and not Proc.Box:isEmpty() then if Proc.Box and not Proc.Box:isEmpty() then
table.insert( vProc, Proc) table.insert( vProc, Proc)
-- se squadratura sui pezzi, si annullano le lavorazioni esterne al box di squadratura
if b3Squaring then
local b3SquaringReduced = BBox3d( b3Squaring)
b3SquaringReduced:expand( -0.1)
if not OverlapsXY( Proc.Box, b3SquaringReduced) then
Proc.Flag = 0
end
end
-- se foro -- se foro
if Drill.Identify( Proc) then if Drill.Identify( Proc) then
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento) -- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
@@ -290,7 +328,8 @@ local function ClassifyFeatures( vProc, b3Raw)
if not bOk then Proc.Flg = 0 end if not bOk then Proc.Flg = 0 end
-- se foratura -- se foratura
elseif Drill.Identify( Proc) then elseif Drill.Identify( Proc) then
local bOk = Drill.Classify( Proc, b3Raw) local bUseMultiDrill = WD.USE_MULTI_DRILL or false
local bOk = Drill.Classify( Proc, b3Raw, bUseMultiDrill)
if not bOk then Proc.Flg = 0 end if not bOk then Proc.Flg = 0 end
-- se mortasatura -- se mortasatura
elseif Mortise.Identify( Proc) then elseif Mortise.Identify( Proc) then
@@ -347,7 +386,7 @@ local function PrintFeatures( vProc)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function AddFeatureMachining( Proc, nRawId, b3Raw, vNLO) local function AddFeatureMachining( Proc, nRawId, b3Raw, vNLO, b3Squaring)
local bOk = true local bOk = true
local sErr = '' local sErr = ''
EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1) EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1)
@@ -370,7 +409,8 @@ local function AddFeatureMachining( Proc, nRawId, b3Raw, vNLO)
-- se foratura ( 3/4-040-X) -- se foratura ( 3/4-040-X)
elseif Drill.Identify( Proc) then elseif Drill.Identify( Proc) then
-- esecuzione foratura -- esecuzione foratura
bOk, sErr = Drill.Make( Proc, nRawId, b3Raw) local bUseMultiDrill = WD.USE_MULTI_DRILL or false
bOk, sErr = Drill.Make( Proc, nRawId, b3Raw, bUseMultiDrill)
-- se mortasatura (3/4-050-X) o similari -- se mortasatura (3/4-050-X) o similari
elseif Mortise.Identify( Proc) then elseif Mortise.Identify( Proc) then
-- esecuzione mortasatura -- esecuzione mortasatura
@@ -390,7 +430,7 @@ local function AddFeatureMachining( Proc, nRawId, b3Raw, vNLO)
-- se contorno libero, outline o apertura ( 0/3/4-250/251/252-X) -- se contorno libero, outline o apertura ( 0/3/4-250/251/252-X)
elseif FreeContour.Identify( Proc) then elseif FreeContour.Identify( Proc) then
-- esecuzione contorno libero -- esecuzione contorno libero
bOk, sErr = FreeContour.Make( Proc, nRawId, b3Raw, vNLO) bOk, sErr = FreeContour.Make( Proc, nRawId, b3Raw, vNLO, b3Squaring)
-- se feature custom (Variant) -- se feature custom (Variant)
elseif Variant.Identify( Proc) then elseif Variant.Identify( Proc) then
-- esecuzione -- esecuzione
@@ -523,7 +563,7 @@ local function SortMach( nPhase, PrevMch, nPartId, nType, StartNames, bExistName
end end
if bByTool then if bByTool then
function ToolCompare(a,b) local function ToolCompare(a,b)
if a.ToolType < b.ToolType then if a.ToolType < b.ToolType then
return true return true
elseif a.ToolType == b.ToolType then elseif a.ToolType == b.ToolType then
@@ -566,7 +606,7 @@ local function SortMach( nPhase, PrevMch, nPartId, nType, StartNames, bExistName
end end
end end
table.sort(TabCut, ToolCompare) table.sort( TabCut, ToolCompare)
-- table.sort(TabCut, function(a,b) return a.ToolType < b.ToolType and a.ToolDiam > b.ToolDiam and a.Tool < b.Tool end) -- table.sort(TabCut, function(a,b) return a.ToolType < b.ToolType and a.ToolDiam > b.ToolDiam and a.Tool < b.Tool end)
local SupportTabCut = {} local SupportTabCut = {}
local nPrevTUUID = 0 local nPrevTUUID = 0
@@ -654,7 +694,7 @@ end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- setto la rimozione sfridi dopo le lavorazioni di outline -- setto la rimozione sfridi dopo le lavorazioni di outline
function InsertScrapRemoval( nPhase) local function InsertScrapRemoval( nPhase)
local nCurrentOperationId = EgtGetNextOperation( EgtGetPhaseDisposition( nPhase)) local nCurrentOperationId = EgtGetNextOperation( EgtGetPhaseDisposition( nPhase))
local nActiveMachiningId = EgtGetCurrMachining() local nActiveMachiningId = EgtGetCurrMachining()
while nCurrentOperationId do while nCurrentOperationId do
@@ -1073,6 +1113,92 @@ local function SetMirroredOperations()
end end
end end
-------------------------------------------------------------------------------------------------------------
local function GetFeatureInfoAndDependency( vProc)
-- ciclo tutte le feature
for i = 1, #vProc do
local Proc = vProc[i]
-- controllo la feature con tutte le altre per recuperare le dipendenze
for j = 1, #vProc do
local ProcB = vProc[j]
-- se non è la stessa feature
if Proc.Id ~= ProcB.Id then
-- raggruppamento fori per eventuale Multidrill
if WD.USE_MULTI_DRILL and Drill.Identify( Proc) and Proc.Flg ~= 0 and Drill.Identify( ProcB) and ProcB.Flg ~= 0 then
if not Proc.OtherGeometries then
Proc.OtherGeometries = {}
end
table.insert( Proc.OtherGeometries, ProcB)
ProcB.Flg = 0
ProcB.bGrouped = true
end
end
end
end
end
-------------------------------------------------------------------------------------------------------------
local function CalculateSquaring( sSquaringTool, RawPart, vPart)
local dRawPartHeight = RawPart.b3:getDimZ()
local bOk
local sMsg = ''
local SquaringTools = {}
local SquaringParameters = {}
local b3Squaring
SquaringTools = Squaring.GetTools()
bOk = Squaring.AreToolsOk( sSquaringTool, SquaringTools, dRawPartHeight)
if not bOk then
sMsg = 'Squaring failed: cannot find matching tools'
return false, {}, nil, sMsg
end
SquaringParameters, b3Squaring = Squaring.CalculateParameters( sSquaringTool, SquaringTools, RawPart, vPart)
if not SquaringParameters or next( SquaringParameters) == nil then
sMsg = 'Squaring failed: cannot calculate parameters'
return false, {}, nil, sMsg
end
return true, SquaringParameters, b3Squaring, sMsg
end
-------------------------------------------------------------------------------------------------------------
local function AddSquaring( SquaringParameters, b3Squaring)
local nFirstOperationId = EgtGetNextOperation( EgtGetPhaseDisposition( 1))
local bOk
local sMsg = ''
local OperationsId = {}
bOk, sMsg, OperationsId = Squaring.AddMachinings( SquaringParameters, b3Squaring, nFirstOperationId)
if not bOk then
for i = 1, #OperationsId do
EgtRemoveOperation( i)
end
sMsg = 'Squaring failed: cannot apply machinings'
return false, sMsg
end
-- se presenti altre lavorazioni, prima di queste va eseguita la pulizia sfridi
if nFirstOperationId then
Squaring.AddScrapRemoval( nFirstOperationId)
end
return true, sMsg
end
-------------------------------------------------------------------------------------------------------------
local function AddFeatureStats( Stats, bOk, sMsg, nCutId, nTaskId)
if not bOk then
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId = nCutId, TaskId = nTaskId})
elseif sMsg and #sMsg > 0 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId = nCutId, TaskId = nTaskId})
else
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId = nCutId, TaskId = nTaskId})
end
return Stats
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function WallExec.ProcessFeatures() function WallExec.ProcessFeatures()
-- errori e stato -- errori e stato
@@ -1090,13 +1216,62 @@ function WallExec.ProcessFeatures()
table.insert( vPart, {Id=nPartId, Box=b3Solid}) table.insert( vPart, {Id=nPartId, Box=b3Solid})
nPartId = EgtGetNextPartInRawPart( nPartId) nPartId = EgtGetNextPartInRawPart( nPartId)
end end
-- calcolo i parametri della squadratura, se richiesta
local SquaringParameters = {}
local b3Squaring
if WD.SQUARING_TYPE and WD.SQUARING_TYPE > 0 then
local RawPart = { nId = nRawId, b3 = b3Raw}
local bOk, sMsg
if type( WD.SQUARING_TOOL) ~= "number" then
WD.SQUARING_TOOL = 0
end
if WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 1 then
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'DoubleDiskmill', RawPart, vPart)
end
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 2) then
-- attualmente non gestito, va modificata la configurazione macchina e non si sa se sia gestito in macchina (PLC)
bOk = false
sMsg = 'Squaring not possible : double blade + diskmill not supported'
--SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'DoubleDiskmillAndBlade', RawPart)
end
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 3) then
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'DoubleBlade', RawPart, vPart)
end
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 4) then
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'Diskmill', RawPart, vPart)
end
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 5) then
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'Blade', RawPart, vPart)
end
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 6) then
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'DoubleMill', RawPart, vPart)
end
if not bOk and ( WD.SQUARING_TOOL == 0 or WD.SQUARING_TOOL == 7) then
bOk, SquaringParameters, b3Squaring, sMsg = CalculateSquaring( 'Mill', RawPart, vPart)
end
-- TODO sostituire con funzione
if not bOk then
nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=0, TaskId=0})
elseif sMsg and #sMsg > 0 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=0, TaskId=0})
else
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=0, TaskId=0})
end
end
-- raccolgo l'elenco delle feature da lavorare, ciclando sui pezzi -- raccolgo l'elenco delle feature da lavorare, ciclando sui pezzi
local vProc = {} local vProc = {}
for i = 1, #vPart do for i = 1, #vPart do
-- recupero le feature di lavorazione della parete -- recupero le feature di lavorazione della parete
local vPartProc = WallExec.CollectFeatures( vPart[i].Id, b3Raw) local vPartProc = WallExec.CollectFeatures( vPart[i].Id, b3Raw, b3Squaring)
vProc = EgtJoinTables( vProc, vPartProc) vProc = EgtJoinTables( vProc, vPartProc)
end end
-- recupero informazioni ausiliarie feature e dipendenze tra feature stesse
GetFeatureInfoAndDependency( vProc)
-- classifico topologicamente le feature -- classifico topologicamente le feature
ClassifyTopology( vProc, nRawId) ClassifyTopology( vProc, nRawId)
-- classifico le feature -- classifico le feature
@@ -1121,16 +1296,22 @@ function WallExec.ProcessFeatures()
-- creo la lavorazione -- creo la lavorazione
local Proc = vProc[i] local Proc = vProc[i]
if Proc.Flg ~= 0 then if Proc.Flg ~= 0 then
local bOk, sMsg = AddFeatureMachining( Proc, nRawId, b3Raw, vNLO) local bOk, sMsg = AddFeatureMachining( Proc, nRawId, b3Raw, vNLO, b3Squaring)
if not bOk then if not bOk then
nTotErr = nTotErr + 1 nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
elseif sMsg and #sMsg > 0 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
else
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
end end
elseif not Proc.Double and not Proc.LockOut then -- output statistiche feature
Stats = AddFeatureStats( Stats, bOk, sMsg, Proc.CutId, Proc.TaskId)
-- output statistiche in caso di più feature lavorate nella stessa Proc
if Proc.OtherGeometries and #Proc.OtherGeometries > 0 then
for j = 1, #Proc.OtherGeometries do
Stats = AddFeatureStats( Stats, Proc.OtherGeometries[j].bOk, Proc.OtherGeometries[j].sMsg, Proc.OtherGeometries[j].CutId, Proc.OtherGeometries[j].TaskId)
if not Proc.OtherGeometries[j].bOk then
nTotErr = nTotErr + 1
end
end
end
elseif not Proc.Double and not Proc.LockOut and not Proc.bGrouped then
local sMsg = 'Feature not machinable by orientation' local sMsg = 'Feature not machinable by orientation'
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId}) table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
end end
@@ -1221,7 +1402,20 @@ function WallExec.ProcessFeatures()
end end
-- ordinamento standard -- ordinamento standard
SortMachinings( nPhase, PrevMch) SortMachinings( nPhase, PrevMch)
-- squadratura, se richiesta
if SquaringParameters and next( SquaringParameters) ~= nil then
local bOk, sMsg = AddSquaring( SquaringParameters, b3Squaring)
-- TODO sostituire con funzione
if not bOk then
nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=0, TaskId=0})
elseif sMsg and #sMsg > 0 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=0, TaskId=0})
else
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=0, TaskId=0})
end
end
-- Aggiornamento finale di tutto -- Aggiornamento finale di tutto
if nGetPriorityFromBtl > 0 then if nGetPriorityFromBtl > 0 then
InsertScrapRemoval( nPhase) InsertScrapRemoval( nPhase)
+2 -2
View File
@@ -157,9 +157,9 @@ local bManualRot = EgtGetInfo( NFAR.PARTID, "MANUALROT", 'b')
-- FLIP -- FLIP
local FlipFeatureStates, bLapJoints = ClassifyFlip( vPartProc, b3Part) local FlipFeatureStates, bLapJoints = ClassifyFlip( vPartProc, b3Part)
local bFlip
if not bManualFlip then if not bManualFlip then
local bFlip
-- analizzo stati flip delle feature -- analizzo stati flip delle feature
local nFlip0Min = 100 local nFlip0Min = 100
local nFlip0Cnt = 0 local nFlip0Cnt = 0
@@ -440,7 +440,7 @@ if not bManualRot then
-- setto info nel pezzo -- setto info nel pezzo
if nRotate > 0 then if nRotate > 0 then
local nPartRot = EgtGetInfo( NFAR.PARTID, "ROTATED", 'i') or 0 local nPartRot = EgtGetInfo( NFAR.PARTID, "ROTATED", 'i') or 0
local nTotRot = nPartRot - nRotate local nTotRot = nPartRot - EgtIf( bFlip, -nRotate, nRotate)
nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot) nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot)
EgtSetInfo( NFAR.PARTID, "ROTATED", nTotRot) EgtSetInfo( NFAR.PARTID, "ROTATED", nTotRot)
EgtSetInfo( NFAR.PARTID, "FLIPROTMODIFIED", 1) EgtSetInfo( NFAR.PARTID, "FLIPROTMODIFIED", 1)
+43 -37
View File
@@ -19,7 +19,7 @@ NEST.MACH_AREA_OTHER_DIAM = 200
NEST.MACH_AREA_IGNORE_3rdFACE = 1 -- 0 NEST.MACH_AREA_IGNORE_3rdFACE = 1 -- 0
local sLog = 'NestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN["1"] .. ', ' .. WIDTH["1"] local sLog = 'NestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN[1] .. ', ' .. WIDTH[1]
EgtOutLog( sLog) EgtOutLog( sLog)
-- Cancello file di log specifico -- Cancello file di log specifico
@@ -1129,8 +1129,9 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot, dMinSheet
nRotate = nRotate - 360 nRotate = nRotate - 360
end end
if nRotate > 0 then if nRotate > 0 then
local bPartFlip = ( ( EgtGetInfo( nPartId, "INVERTED", 'i') or 0) == 180)
local nPartRot = EgtGetInfo( nPartId, "ROTATED", 'i') or 0 local nPartRot = EgtGetInfo( nPartId, "ROTATED", 'i') or 0
local nTotRot = nPartRot - nRotate local nTotRot = nPartRot - EgtIf( bPartFlip, -nRotate, nRotate)
nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot) nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot)
EgtSetInfo( nPartId, "ROTATED", nTotRot) EgtSetInfo( nPartId, "ROTATED", nTotRot)
EgtSetInfo( nPartId, "MODIFIEDFORNEST", 1) EgtSetInfo( nPartId, "MODIFIEDFORNEST", 1)
@@ -1325,8 +1326,9 @@ local function ComputeRestrictedZones( RawParts)
bOnOppositeSide = true bOnOppositeSide = true
-- aggiorno le info di rotazione -- aggiorno le info di rotazione
if res.nRotate > 0 then if res.nRotate > 0 then
local bPartFlip = ( ( EgtGetInfo( AngleClassification[nInd].PartId, "INVERTED", 'i') or 0) == 180)
local nPartRot = EgtGetInfo( AngleClassification[nInd].PartId, "ROTATED", 'i') or 0 local nPartRot = EgtGetInfo( AngleClassification[nInd].PartId, "ROTATED", 'i') or 0
local nTotRot = nPartRot - res.nRotate local nTotRot = nPartRot - EgtIf( bPartFlip, -res.nRotate, res.nRotate)
nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot) nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot)
EgtSetInfo( AngleClassification[nInd].PartId, "ROTATED", nTotRot) EgtSetInfo( AngleClassification[nInd].PartId, "ROTATED", nTotRot)
EgtSetInfo( AngleClassification[nInd].PartId, "MODIFIEDFORNEST", 1) EgtSetInfo( AngleClassification[nInd].PartId, "MODIFIEDFORNEST", 1)
@@ -1507,7 +1509,6 @@ local function AddParts(RawParts, vPartsDoneManually)
bRotNest = false bRotNest = false
elseif EgtExistsInfo( nPartId, "NestRot") then elseif EgtExistsInfo( nPartId, "NestRot") then
nStepRotNest = EgtGetInfo( nPartId, "NestStepRot", 'i') nStepRotNest = EgtGetInfo( nPartId, "NestStepRot", 'i')
nRotate = EgtGetInfo( nPartId, "NestRot", 'i')
bRotNest = EgtGetInfo( nPartId, "NestAllowRot", 'b') bRotNest = EgtGetInfo( nPartId, "NestAllowRot", 'b')
-- verifico se rotazione è valida (pezzo è contenuto nel grezzo) -- verifico se rotazione è valida (pezzo è contenuto nel grezzo)
local bValidRotationInRaw = b3Part:getDimX() < RawParts[1].Len - 2 * NEST.KERF + GEO.EPS_SMALL and b3Part:getDimY() < dRawMaxWidth - 2 * NEST.KERF + GEO.EPS_SMALL local bValidRotationInRaw = b3Part:getDimX() < RawParts[1].Len - 2 * NEST.KERF + GEO.EPS_SMALL and b3Part:getDimY() < dRawMaxWidth - 2 * NEST.KERF + GEO.EPS_SMALL
@@ -1806,41 +1807,40 @@ if bNestingOk then
end end
end end
-- aggiungo pezzi nestati a mano -- aggiungo pezzi nestati a mano
nPartCount = 0 nPartCount = 0
for nInd = 1, #vDoneManually do for nInd = 1, #vDoneManually do
if vDoneManually[nInd].SheetId == nId then if vDoneManually[nInd].SheetId == nId then
vDoneManually[nInd].Done = 1 vDoneManually[nInd].Done = 1
for nInd2 = 1, #(vDoneManually[nInd].Parts) do for nInd2 = 1, #(vDoneManually[nInd].Parts) do
nPartCount = nPartCount + 1 nPartCount = nPartCount + 1
local nPartDuploId = EgtDuploNew( vDoneManually[nInd].Parts[nInd2].Id) local nPartDuploId = EgtDuploNew( vDoneManually[nInd].Parts[nInd2].Id)
-- aggiungo le curve corrispondenti alle aree di lavorazione del pezzo -- aggiungo le curve corrispondenti alle aree di lavorazione del pezzo
local sToolOutlines = EgtGetInfo( vDoneManually[nInd].Parts[nInd2].Id, "ToolOutlines", 's') local sToolOutlines = EgtGetInfo( vDoneManually[nInd].Parts[nInd2].Id, "ToolOutlines", 's')
if sToolOutlines then if sToolOutlines then
-- recupero o creo il gruppo per gli outlines -- recupero o creo il gruppo per gli outlines
local nToolOutlinesGrp = EgtGetFirstNameInGroup( nPartDuploId, "ToolOutlines") local nToolOutlinesGrp = EgtGetFirstNameInGroup( nPartDuploId, "ToolOutlines")
if not nToolOutlinesGrp then if not nToolOutlinesGrp then
nToolOutlinesGrp = EgtGroup( nPartDuploId) nToolOutlinesGrp = EgtGroup( nPartDuploId)
EgtSetName( nToolOutlinesGrp, "ToolOutlines") EgtSetName( nToolOutlinesGrp, "ToolOutlines")
EgtSetStatus( nToolOutlinesGrp, GDB_ST.ON) EgtSetStatus( nToolOutlinesGrp, GDB_ST.ON)
end
for str in string.gmatch(sToolOutlines, "([^"..",".."]+)") do
EgtCopyGlob( tonumber(str), nToolOutlinesGrp)
end
end end
for str in string.gmatch(sToolOutlines, "([^"..",".."]+)") do -- applico flip, rotazione e traslazione pezzo e box da nesting
EgtCopyGlob( tonumber(str), nToolOutlinesGrp) EgtSetInfo( nMachGroup, "PART" .. nPartCount, nPartDuploId .. "," .. EgtNumToString( vDoneManually[nInd].Parts[nInd2].posX, 3) .. "," .. EgtNumToString( vDoneManually[nInd].Parts[nInd2].posY, 3) .. "," .. 0 .."," .. 0)
end EgtSetInfo( nPartDuploId, "POSX", vDoneManually[nInd].Parts[nInd2].posX)
EgtSetInfo( nPartDuploId, "POSY", vDoneManually[nInd].Parts[nInd2].posY)
end end
-- applico flip, rotazione e traslazione pezzo e box da nesting
EgtSetInfo( nMachGroup, "PART" .. nPartCount, nPartDuploId .. "," .. EgtNumToString( vDoneManually[nInd].Parts[nInd2].posX, 3) .. "," .. EgtNumToString( vDoneManually[nInd].Parts[nInd2].posY, 3) .. "," .. 0 .."," .. 0)
EgtSetInfo( nPartDuploId, "POSX", vDoneManually[nInd].Parts[nInd2].posX)
EgtSetInfo( nPartDuploId, "POSY", vDoneManually[nInd].Parts[nInd2].posY)
end end
end end
end end
end
-- altrimenti pezzo -- altrimenti pezzo
else else
nPartCount = nPartCount + 1 nPartCount = nPartCount + 1
@@ -1884,15 +1884,21 @@ if bNestingOk then
EgtSetInfo( nPartDuploId, "POSX", ptPos:getX() + dXCorr) EgtSetInfo( nPartDuploId, "POSX", ptPos:getX() + dXCorr)
EgtSetInfo( nPartDuploId, "POSY", ptPos:getY() + dYCorr) EgtSetInfo( nPartDuploId, "POSY", ptPos:getY() + dYCorr)
local nPartRot = EgtGetInfo( nId, "ROTATED", 'i') or 0 local nPartFlip = EgtGetInfo( nId, "INVERTED", 'i') or 0
local nTotRot = dAngRot - nPartRot
nTotRot = EgtIf( nTotRot < 0, nTotRot + 360, nTotRot)
EgtSetInfo( nPartDuploId, "ROT", nTotRot)
local nPartFlip = EgtGetInfo( nId, "INVERTED", 'i')
nPartFlip = EgtIf( nPartFlip == 180, 1, 0) nPartFlip = EgtIf( nPartFlip == 180, 1, 0)
local nTotFlip = EgtIf( nPartFlip ~= nFlag, 180, 0) local nTotFlip = EgtIf( nPartFlip ~= nFlag, 180, 0)
EgtSetInfo( nPartDuploId, "FLIP", nTotFlip) EgtSetInfo( nPartDuploId, "FLIP", nTotFlip)
local bPartFlip = ( nTotFlip == 180)
local nPartRot = EgtGetInfo( nId, "ROTATED", 'i') or 0
local nTotRot = nPartRot - EgtIf( bPartFlip, -dAngRot, dAngRot)
if nTotRot < 0 then
nTotRot = nTotRot + 360
elseif nTotRot >= 360 then
nTotRot = nTotRot - 360
end
EgtSetInfo( nPartDuploId, "ROT", nTotRot)
end end
end end
end end
+73
View File
@@ -1,5 +1,78 @@
==== Wall Update Log ==== ==== Wall Update Log ====
Versione 2.7g2 (17/07/2025)
- Added : aggiunta gestione origine e offset da questa che non fanno riprocessare l'intero grezzo (ma solo aggiornare)
- Fixed : corretta BatchProcess per nome file anche se da non riprocessare.
Versione 2.7g1 (09/07/2025)
- Fixed : in FreeContour corretta scelta del lato da lavorare in caso si abbiano lati inclinati
Versione 2.7f2 (06/06/2025)
- Fixed : in Lapjoint migliorie alle svuotature
Versione 2.7f1 (05/06/2025)
- Added : gestita forzatura freecontour di fresa per macchine senza lama (costante WallData FORCE_MILL_CONTOUR)
- Modif : migliorata DoubleCut
- Fixed : corretta BatchProcess per caso in cui il nome del file cnc generato non era corretto
Versione 2.7d1 (14/04/2025)
- Added : in DoubleCut aggiunta Q06 per forzare utilizzo lama
Versione 2.7b1 (03/03/2025)
- Added : gestione multidrill
Versione 2.7a2 (23/01/2025)
- Fixed : in Ts7 corretto un problema che portava a rotazioni errate, introdotto con 2.7a1
- Fixed : in squadratura piccole correzioni
Versione 2.7a1 (21/01/2025)
- Modif : in Ts7 aggiunta scrittura id progetto e produzione in Btm
Versione 2.6l1 (11/12/2024)
- Modif : modificato il calcolo feature passante per gorge
- Modif : in pulizia spigoli si riporta correttamente la collisione sulla feature specifica
- Fixed : in pulizia spigoli correzioni varie
- Fixed : in LapJoint correzioni varie
Versione 2.6k3 (27/11/2024)
- Modif : migliorato calcolo approccio e retrazione in Sidemill/Sidegroove
Versione 2.6k2 (19/11/2024)
- Modif : in Nesting riportata allo stato precedente la tolleranza posizionamento pannelli sul bordo
Versione 2.6k1 (14/11/2024)
- Added : aggiunta squadratura master panel
- Modif : L010 si inseriscono con lama anche se il percorso è breve
- Fixed : in Nesting corretto errore in posizionamento pannelli che devono stare necessariamente sul bordo della tavola
Versione 2.6j2 (04/11/2024)
- Modif : Modificato limite dimensione tasca per utilizzo lama come SideGroove
Versione 2.6j1 (29/10/2024)
- Fixed : in Nesting e Flip/Rot corretto problema in rotazione pezzi che causava ribaltamenti non voluti nella copia grezzo
Versione 2.6i2 (30/09/2024)
- Modif : aggiunta nota altezza sottopezzo, per pareti a layer
Versione 2.6i1 (25/09/2024)
- Fixed : in NestProcess correzione in lettura array per cambio dll di lettura
Versione 2.6h2 (28/08/2024)
- Modif : Aggiunto controllo licenza/chiave per abilitazione generazione PartProgram
- Fixed : in FreeContour corretto caso in cui si chiedevano informazioni sulla faccia non presenti.
Versione 2.6h1 (20/08/2024)
- Modif : in LapJoint, se fresa Side trovata ma non applicabile, si considera come se non trovata
- Modif : in Collect analisi facce limitata a feature che ne hanno meno di 50
- Modif : aggiunti nuovi parametri alla chiamata della funzione GetChainSawStartAngs da WallData della macchina
Versione 2.6g2 (19/07/2024)
- Modif : in BatchProcess e BatchProcessNew si forza ricalcolo ogni volta che si è in situazione di CHECK o CHECK + GENERATE
Versione 2.6g1 (17/07/2024)
- Modif : in ProcessDrill, se foro verticale passante e diametro inferiore a 100 mm, riduzione affondamento di 5 mm sostituito con tab
- Fixed : correzioni a utilizzo DEFAULT_RAW_NO_EXTRA_WIDTH
Versione 2.6f1 (21/06/2024) Versione 2.6f1 (21/06/2024)
- Added : in BatchProcess e BatchProcessNew aggiunto DEFAULT_RAW_NO_EXTRA_WIDTH per eliminare il sovramateriale grezzo in vista - Added : in BatchProcess e BatchProcessNew aggiunto DEFAULT_RAW_NO_EXTRA_WIDTH per eliminare il sovramateriale grezzo in vista
+3 -3
View File
@@ -1,6 +1,6 @@
-- Version.lua by Egalware s.r.l. 2024/03/24 -- Version.lua by Egalware s.r.l. 2025/07/17
-- Gestione della versione di Wall -- Gestione della versione di Wall
NAME = 'Wall' NAME = 'Wall'
VERSION = '2.6f1' VERSION = '2.7g2'
MIN_EXE = '2.6c2' MIN_EXE = '2.7f2'