Compare commits

...

61 Commits

Author SHA1 Message Date
luca.mazzoleni 04b0650f96 Refactoring/MoveSomeFunctionsToBeamLib:
Fix commenti
2022-09-01 16:15:35 +02:00
luca.mazzoleni 8b31881abb Refactoring/MoveSomeFunctionsToBeamLib:
spostata SetOpenSide da LapJoint a BeamLib
2022-09-01 16:08:50 +02:00
luca.mazzoleni 055d8bd4d3 Refactoring/MoveSomeFunctionsToBeamLib:
piccola correzione
2022-09-01 15:52:49 +02:00
luca.mazzoleni b0e10cee87 Refactoring/MoveSomeFunctionsToBeamLib:
spostate le funzioni GetTunnelDimension e CalcCollisionSafety da LapJoint a BeamLib
2022-09-01 15:24:08 +02:00
luca.mazzoleni a9e43984a2 Merge branch 'BugFix/Ticket#787' into develop 2022-08-30 14:52:35 +02:00
luca.mazzoleni 1e93303981 BugFix/Ticket#787:
In ProcessCut modificata la condizione che determina l'utilizzo della testa da sotto. Ora controlla se la trave è più grande del doppio della massima larghezza del cubetto.
2022-08-30 14:42:26 +02:00
luca.mazzoleni 7fec3d6584 in DoubleCut aggiunta la gestione del parametro CUT_VZ_MIN, da BeamData 2022-08-29 15:47:04 +02:00
luca.mazzoleni e61cc2ba08 Merge branch 'BugFix/DoubleCutCollision' into develop 2022-08-29 13:25:42 +02:00
luca.mazzoleni 516a56c8b5 BugFix/DoubleCutCollision:
update commenti
2022-08-29 13:25:07 +02:00
luca.mazzoleni 2482338a12 BugFix/DoubleCutCollision:
inDoubleCut implementata la fresatura di lato nel caso di lavorazione con lama problematica
2022-08-29 12:52:57 +02:00
luca.mazzoleni 0528ac4a31 BugFix/DoubleCutCollision:
doublecut impostata per lanciare fresatura di lato in caso di lavorazione con lama problematica; da aggiungere la fresatura di lato
2022-08-26 18:30:49 +02:00
luca.mazzoleni 4e77597b7d Merge remote-tracking branch 'origin/master' into develop 2022-08-26 12:43:34 +02:00
DarioS 058babe605 DataBeam :
- modifiche su lavorazione di Profili Concavo e Convesso per macchina Turn.
2022-08-25 17:47:50 +02:00
luca.mazzoleni a7676c7331 Merge branch 'BugFix/CutOnShortAndTallBeams' into develop 2022-08-25 16:35:02 +02:00
luca.mazzoleni f1abaeaac3 Merge branch 'master' into develop 2022-08-25 16:34:51 +02:00
luca.mazzoleni 5db6398725 BugFix/CutOnShortAndTallBeams:
migliorato il calcolo della riduzione di profondità di lavorazione
2022-08-25 16:12:32 +02:00
luca.mazzoleni a8924f4425 BugFix/CutOnShortAndTallBeams:
In ProcessCut nel caso di pezzi corti (AdvTail) con taglio lungo Y la profondità di lavorazione è opportunamente diminuita.
2022-08-25 12:32:57 +02:00
DarioS e4c5a2e06d DataBeam :
- piccoli aggiustamenti per TURN.
2022-08-25 11:42:34 +02:00
luca.mazzoleni 29ed56df16 Merge branch 'BugFix/NoDicingIfCutNotThickerThanSaw' into develop 2022-08-24 16:56:34 +02:00
luca.mazzoleni 6d64f2232d BugFix/NoDicingIfCutNotThickerThanSaw:
In ProcessCut disabilitato il dicing per tagli meno spessi della lama
2022-08-24 16:45:47 +02:00
luca.mazzoleni e0abdbbe63 Merge branch 'Feature/MarkingInFreeContour' into develop 2022-08-23 18:29:34 +02:00
luca.mazzoleni 45afa144ad Feature/MarkingInFreeContour:
In FreeContour aggiunta la gestione dell'utensile penna per P13=10
2022-08-23 18:19:44 +02:00
luca.mazzoleni dc4a0eda3e Merge remote-tracking branch 'origin/master' into develop 2022-08-23 12:00:10 +02:00
DarioS b0cdb95e48 DataBeam :
- modifiche a lavorazione FreeContour per macchine con testa da sotto.
2022-08-23 11:49:05 +02:00
luca.mazzoleni 53e8605297 Merge branch 'BugFix/BetterFaceuseOnCutOnTail' into develop 2022-08-23 10:42:53 +02:00
luca.mazzoleni 41e490dcd2 Merge branch 'develop' into BugFix/BetterFaceuseOnCutOnTail 2022-08-23 08:54:30 +02:00
luca.mazzoleni 56f66d66c3 Merge remote-tracking branch 'origin/master' into develop 2022-08-23 08:54:07 +02:00
DarioS 7497b62dee DataBeam :
- in mortase a coda di rondine migliorato calcolo step tra passate.
2022-08-18 19:38:00 +02:00
DarioS e67e397225 DataBeam :
- modiciche a taglio di testa e taglio di separazione per macchine con testa da sotto con lama disabilitata
- modiciche a forature per macchine con testa da sotto con puntaa disabilitata.
2022-08-18 15:11:21 +02:00
luca.mazzoleni a972fbd425 BugFix/BetterFaceuseOnCutOnTail
nella ProcessCut i tagli inclinati in coda ora partono dal centro (scelta faceUse migliore)
2022-08-12 17:48:12 +02:00
luca.mazzoleni d5140acc91 BugFix:
correzioni minori
2022-08-12 09:58:33 +02:00
luca.mazzoleni b197c96a34 Feature/DoubleSideChainSawLapJoint
modificati commenti
2022-08-12 09:27:06 +02:00
luca.mazzoleni f3a72a7683 Merge branch 'Feature/DoubleSideChainSawLapJoint' into develop 2022-08-11 19:05:36 +02:00
luca.mazzoleni d72560241b Feature/DoubleSideChainSawLapJoint:
In ProcessLapJoint aggiunta lavorazione tunnel splittata con sega a catena per tutte le macchine ad esclusione della Fast
2022-08-11 18:58:18 +02:00
luca.mazzoleni 0689328082 BugFix/LapJointL2FacesQ03:
in L030 corretta lavorazionedi facce a L verso Y con parametro Q03=2/3
2022-08-10 13:07:35 +02:00
luca.mazzoleni a1a6f2243a Merge branch 'BugFix/ScarfOneFaceReduceToCut' into develop 2022-08-09 11:47:21 +02:00
luca.mazzoleni 2081b15276 BugFix/ScarfOneFaceReduceToCut:
ora se il giunto Gerber ha una sola faccia viene richiamata la Process.Cut
2022-08-09 09:41:17 +02:00
luca.mazzoleni c810aea200 Merge branch 'master' into develop 2022-08-09 09:15:38 +02:00
DarioS a684b5a5db DataBeam :
- correzione in BeamExec per macchine senza BD.MAX_WIDTH2 e BD.MAX_HEIGHT2
- migliorata gestione L030 sotto con 3 facce
- migliorata gestione affondamento/elevazione lavorazioni con sega a catena.
2022-08-09 07:09:35 +02:00
DarioS a5f80f5c25 DataBeam :
- modifiche a Mortise per lato mensola asse C FAST e per direzione lavoro con mortasatrice a catena.
2022-08-03 08:38:33 +02:00
DarioS 28af706910 DataBeam :
- tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL)
- funzioni StartsWith e EndsWith sostituite da analoghe funzioni di libreria (con prefisso Egt)
- corretta gestione tagli con testa che taglia da sotto in su
- riordino forature per gestione inclinazione limite da superficie trave
- in Mortasature se non si può pulire angoli con mortasatrice warning invece di errore.
2022-08-01 17:39:49 +02:00
luca.mazzoleni 94508d51c8 Merge branch 'Feature/MortiseCornerFinishing' into develop 2022-07-29 18:50:51 +02:00
luca.mazzoleni 90513d2ca7 Feature/MortiseCornerFinishing:
aggiunto check dimensioni tasca vs utensile
corretta direzione attacco utensile per mortasa frontale
2022-07-29 18:50:39 +02:00
luca.mazzoleni acf568d8db Merge branch 'Feature/MortiseCornerFinishing' into develop 2022-07-29 10:06:51 +02:00
luca.mazzoleni eedf701fa6 Feature/MortiseCornerFinishing:
modifiche minori
2022-07-29 10:05:47 +02:00
luca.mazzoleni 6780d5e5f5 Merge branch 'Feature/AngledDrillings' into develop 2022-07-28 09:39:17 +02:00
luca.mazzoleni 72f572d27a Merge branch 'Feature/AngledDrillings' into Feature/MortiseCornerFinishing 2022-07-28 09:13:45 +02:00
luca.mazzoleni 980081deb5 Merge branch 'develop' into Feature/AngledDrillings 2022-07-28 09:02:39 +02:00
luca.mazzoleni 67bb7ad3d9 Merge remote-tracking branch 'origin/master' into develop 2022-07-27 17:57:38 +02:00
luca.mazzoleni 358dee8808 Feature/AngledDrillings:
implemento foratura tipo AngleDrill per fori molto inclinati
2022-07-27 17:54:59 +02:00
DarioS 480fa7bfb1 DataBeam :
- modifiche per taglio di separazione con sega a catena (verifica se necessario e tipologia).
2022-07-27 15:41:07 +02:00
luca.mazzoleni 30b30471fc Feature/MortiseCornerFinishing:
per mortasa implementata la finitura degli angoli con parametro P04=1, con apposito utensile
2022-07-26 16:46:50 +02:00
luca.mazzoleni 8b560421f7 Merge remote-tracking branch 'origin/master' into develop 2022-07-25 15:34:37 +02:00
DarioS 091785a31d DataBeam :
- correzione orientamento braccio in taglio con lama L013 sui fianchi.
2022-07-25 14:07:00 +02:00
luca.mazzoleni 35c08ef493 Merge remote-tracking branch 'origin/HEAD' into develop 2022-07-25 11:17:13 +02:00
DarioS 5f4ec79707 DataBeam :
- in BatchProcessNew modifica per cancellare lavorazioni con ricalcolo e barra già definita.
2022-07-25 10:40:25 +02:00
luca.mazzoleni bff6c0fb2a Merge remote-tracking branch 'origin/master' into develop 2022-07-19 11:08:48 +02:00
DarioS 4f018b29f1 DataBeam :
- piccole migliorie sui tagli di lama.
2022-07-19 10:59:25 +02:00
luca.mazzoleni cad8e84bd8 Merge branch 'BugFix/LongCutOnT10AlsoOnSide' into develop 2022-07-18 15:22:40 +02:00
luca.mazzoleni 525ac0846d BugFix/LongCutOnT10AlsoOnSide:
LongCut anche per feature sul lato per macchine tipo PF1250
2022-07-18 15:22:16 +02:00
luca.mazzoleni 3ec71014cd Merge branch 'BugFix/AvoidSawDamagingRemainingBarIfNotShort' into develop 2022-07-14 18:57:40 +02:00
22 changed files with 1363 additions and 628 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ if BEAM.FLAG == 0 then
elseif BEAM.FLAG == 1 then elseif BEAM.FLAG == 1 then
sFlag = 'MODIFY' sFlag = 'MODIFY'
elseif BEAM.FLAG == 2 then elseif BEAM.FLAG == 2 then
sFlag = 'SIMULATE' sFlag = 'SIMULATE'
elseif BEAM.FLAG == 3 then elseif BEAM.FLAG == 3 then
sFlag = 'CHECK' sFlag = 'CHECK'
elseif BEAM.FLAG == 4 then elseif BEAM.FLAG == 4 then
+8 -4
View File
@@ -1,4 +1,4 @@
-- BatchProcessNew.lua by Egaltech s.r.l. 2022/04/28 -- BatchProcessNew.lua by Egaltech s.r.l. 2022/08/01
-- Gestione calcolo batch disposizione e lavorazioni per Travi -- Gestione calcolo batch disposizione e lavorazioni per Travi
-- 2021/01/07 Per nuova interfaccia Egt. -- 2021/01/07 Per nuova interfaccia Egt.
-- 2021/01/15 CREATE_BAR ora FLAG = 6 (prima 5). -- 2021/01/15 CREATE_BAR ora FLAG = 6 (prima 5).
@@ -10,6 +10,8 @@
-- 2022/01/07 Per CUTID/TASKID senza ToProcess si verificano anche eventuali Duplo. -- 2022/01/07 Per CUTID/TASKID senza ToProcess si verificano anche eventuali Duplo.
-- 2022/02/09 Aggiornato come Wall per gestione errori e verifica attrezzaggio utensili. -- 2022/02/09 Aggiornato come Wall per gestione errori e verifica attrezzaggio utensili.
-- 2022/04/28 In info generazione aggiunta indicazione se 64bit. -- 2022/04/28 In info generazione aggiunta indicazione se 64bit.
-- 2022/07/24 Modifica per cancellare lavorazioni con ricalcolo e barra già definita.
-- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
-- Intestazioni -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -29,7 +31,7 @@ if BEAM.FLAG == 0 then
elseif BEAM.FLAG == 1 then elseif BEAM.FLAG == 1 then
sFlag = 'MODIFY' sFlag = 'MODIFY'
elseif BEAM.FLAG == 2 then elseif BEAM.FLAG == 2 then
sFlag = 'SIMULATE' sFlag = 'SIMULATE'
elseif BEAM.FLAG == 3 then elseif BEAM.FLAG == 3 then
sFlag = 'CHECK' sFlag = 'CHECK'
elseif BEAM.FLAG == 4 then elseif BEAM.FLAG == 4 then
@@ -333,8 +335,8 @@ if bToProcess then
for i = 2, #vBeam do for i = 2, #vBeam do
local dDimW = vBeam[i].Box:getDimY() local dDimW = vBeam[i].Box:getDimY()
local dDimH = vBeam[i].Box:getDimZ() local dDimH = vBeam[i].Box:getDimZ()
if ( abs( dDimW - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL) and if ( abs( dDimW - dRawW) > 100 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 100 * GEO.EPS_SMALL) and
( abs( dDimH - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 10 * GEO.EPS_SMALL) then ( abs( dDimH - dRawW) > 100 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 100 * GEO.EPS_SMALL) then
table.insert( vBeamErr, i) table.insert( vBeamErr, i)
end end
end end
@@ -435,6 +437,8 @@ if bToProcess then
-- passo al successivo grezzo -- passo al successivo grezzo
nRawId = EgtGetNextRawPart( nRawId) nRawId = EgtGetNextRawPart( nRawId)
end end
-- elimino le lavorazioni
EgtRemoveAllOperations()
end end
-- Se richiesta solo barra, esco -- Se richiesta solo barra, esco
+44 -12
View File
@@ -1,4 +1,4 @@
-- BeamExec.lua by Egaltech s.r.l. 2022/06/25 -- BeamExec.lua by Egaltech s.r.l. 2022/08/18
-- Libreria esecuzione lavorazioni per Travi -- Libreria esecuzione lavorazioni per Travi
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
-- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato. -- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato.
@@ -32,6 +32,9 @@
-- Create le funzioni AnalyzeHeadFeatures e AnalyzeTailFeatures. Spostate più in alto le funzioni CollectFeatures, isHeadFeature e isTailFeature. -- Create le funzioni AnalyzeHeadFeatures e AnalyzeTailFeatures. Spostate più in alto le funzioni CollectFeatures, isHeadFeature e isTailFeature.
-- 2022/07/01 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda ad 1 faccia che tagliano tutta la sezione, -- 2022/07/01 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda ad 1 faccia che tagliano tutta la sezione,
-- controllata tramite il parametro IMPROVE_HEAD_TAIL_DRILLINGS da BeamData. Attivata di default. -- controllata tramite il parametro IMPROVE_HEAD_TAIL_DRILLINGS da BeamData. Attivata di default.
-- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
-- 2022/08/08 Modifica per macchine senza BD.MAX_WIDTH2 e BD.MAX_HEIGHT2.
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local BeamExec = {} local BeamExec = {}
@@ -86,7 +89,7 @@ _G.package.loaded.ProcessTyroleanDovetail = nil
_G.package.loaded.ProcessDovetail = nil _G.package.loaded.ProcessDovetail = nil
_G.package.loaded.ProcessFreeContour = nil _G.package.loaded.ProcessFreeContour = nil
_G.package.loaded.ProcessDecor = nil _G.package.loaded.ProcessDecor = nil
local BM = require( 'MachiningLib') local ML = require( 'MachiningLib')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local DC = require( 'DiceCut') local DC = require( 'DiceCut')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
@@ -387,6 +390,34 @@ end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle travi nel grezzo *** -- *** Inserimento delle travi nel grezzo ***
-------------------------------------------------------------------------------------------------------------
local function VerifyBigSectionCut( dRawW, dRawH)
-- lama principale
local sCutting = ML.FindCutting( 'TailSide')
local dMaxDepth = 50
if EgtMdbSetCurrMachining( sCutting or '') then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid or '') or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- eventuale lama su testa sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
local dMaxDepth2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- verifiche
local dDimYRef = EgtIf( dRawH < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( dRawW > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( dRawH > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
return bBigSectionCut
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk) function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk)
@@ -426,11 +457,8 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
local DeltaS = dOvmHead local DeltaS = dOvmHead
local DeltaSMin = 0 local DeltaSMin = 0
local DeltaE = BD.OVM_MID local DeltaE = BD.OVM_MID
-- controllo sezione larga e alta per considerare taglio con sega -- controllo sezione larga e alta per considerare taglio con sega a catena
local bBigSectionCut = false local bBigSectionCut = VerifyBigSectionCut( dRawW, dRawH)
if BD.MAX_DIM_HTCUT and BD.CUT_EXTRA_MIN and ( dRawW > 2 * BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( dRawH > 2 * BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) then
bBigSectionCut = true
end
for i = 1, #vBeam do for i = 1, #vBeam do
-- assegno identificativo pezzo -- assegno identificativo pezzo
local Pz = vBeam[i].Id local Pz = vBeam[i].Id
@@ -475,8 +503,8 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
local PartWidth = b3Solid:getDimY() local PartWidth = b3Solid:getDimY()
local PartHeight = b3Solid:getDimZ() local PartHeight = b3Solid:getDimZ()
local NextLen = Len - DeltaS - PartLen - DeltaE local NextLen = Len - DeltaS - PartLen - DeltaE
if (( abs( PartWidth - dRawW) < 10 * GEO.EPS_SMALL and abs( PartHeight - dRawH) < 10 * GEO.EPS_SMALL) or if (( abs( PartWidth - dRawW) < 100 * GEO.EPS_SMALL and abs( PartHeight - dRawH) < 100 * GEO.EPS_SMALL) or
( abs( PartHeight - dRawW) < 10 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 10 * GEO.EPS_SMALL)) and ( abs( PartHeight - dRawW) < 100 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 100 * GEO.EPS_SMALL)) and
NextLen + DeltaE >= 0 then NextLen + DeltaE >= 0 then
-- eventuale sovramateriale di testa -- eventuale sovramateriale di testa
if i > 1 and vBeam[i].PosX then if i > 1 and vBeam[i].PosX then
@@ -515,7 +543,7 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
EgtDeselectPartObjs( Pz) EgtDeselectPartObjs( Pz)
local ptPos = b3Part:getMin() - b3Solid:getMin() + Vector3d( Delta, ( dRawW - PartWidth) / 2, ( dRawH - PartHeight) / 2) local ptPos = b3Part:getMin() - b3Solid:getMin() + Vector3d( Delta, ( dRawW - PartWidth) / 2, ( dRawH - PartHeight) / 2)
EgtAddPartToRawPart( Pz, ptPos, nRaw) EgtAddPartToRawPart( Pz, ptPos, nRaw)
if abs( PartWidth - dRawW) > 10 * GEO.EPS_SMALL then if abs( PartWidth - dRawW) > 100 * GEO.EPS_SMALL then
-- rotazione attorno a centro geometria complessiva del pezzo -- rotazione attorno a centro geometria complessiva del pezzo
EgtRotatePartInRawPart( Pz, X_AX(), 90) EgtRotatePartInRawPart( Pz, X_AX(), 90)
-- correggo per eccentricità solido rispetto a geometria complessiva del pezzo -- correggo per eccentricità solido rispetto a geometria complessiva del pezzo
@@ -582,8 +610,12 @@ local function Verify90DegRotation( nRawId)
local dRawW = EgtGetRawPartBBox( nRawId):getDimY() local dRawW = EgtGetRawPartBBox( nRawId):getDimY()
local dRawH = EgtGetRawPartBBox( nRawId):getDimZ() local dRawH = EgtGetRawPartBBox( nRawId):getDimZ()
-- verifica dell'altezza rispetto alla massima larghezza -- verifica dell'altezza rispetto alla massima larghezza
return ( dRawH < BD.MAX_WIDTH + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL) or if not BD.MAX_WIDTH2 or not BD.MAX_HEIGHT2 then
( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL) return ( dRawH < BD.MAX_WIDTH + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL)
else
return ( dRawH < BD.MAX_WIDTH + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT + 10 * GEO.EPS_SMALL) or
( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL)
end
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
+260 -7
View File
@@ -14,6 +14,9 @@
-- 2022/05/18 Correzioni e migliorie a PutStartNearestToEdge. -- 2022/05/18 Correzioni e migliorie a PutStartNearestToEdge.
-- 2022/06/25 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs prima in ProcessLapJpoint. -- 2022/06/25 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs prima in ProcessLapJpoint.
-- 2022/07/12 A GetFaceHvRefDim aggiunta possibilità di confronto e limitazione dimensioni con grezzo/pezzo (conta solo la sezione). -- 2022/07/12 A GetFaceHvRefDim aggiunta possibilità di confronto e limitazione dimensioni con grezzo/pezzo (conta solo la sezione).
-- 2022/07/26 Aggiunta la funzione FindFaceBestOrientedAsAxis, precedentemente in ProcessLapJoint
-- 2022/07/26 Alla funzione FindFaceBestOrientedAsAxis aggiunta la possibilità di escludere una faccia dalla ricerca
-- 2022/09/01 Aggiunte le funzioni GetTunnelDimension, CalcCollisionSafety, SetOpenSide, precedentemente in ProcessLapJoint.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local BeamLib = {} local BeamLib = {}
@@ -369,17 +372,17 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function BeamLib.GetVersRef( nOrthoOpposite) function BeamLib.GetVersRef( nOrthoOpposite)
if nOrthoOpposite == MCH_MILL_FU.ORTHO_LEFT then if nOrthoOpposite == MCH_MILL_FU.ORTHO_LEFT or nOrthoOpposite == MCH_MILL_FU.ORTUP_LEFT or nOrthoOpposite == MCH_MILL_FU.PARAL_LEFT then
return X_AX() return X_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_RIGHT then elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_RIGHT or nOrthoOpposite == MCH_MILL_FU.ORTUP_RIGHT or nOrthoOpposite == MCH_MILL_FU.PARAL_RIGHT then
return -X_AX() return -X_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_FRONT then elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_FRONT or nOrthoOpposite == MCH_MILL_FU.ORTUP_FRONT or nOrthoOpposite == MCH_MILL_FU.PARAL_FRONT then
return Y_AX() return Y_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_BACK then elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_BACK or nOrthoOpposite == MCH_MILL_FU.ORTUP_BACK or nOrthoOpposite == MCH_MILL_FU.PARAL_BACK then
return -Y_AX() return -Y_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_DOWN then elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_DOWN or nOrthoOpposite == MCH_MILL_FU.ORTUP_DOWN or nOrthoOpposite == MCH_MILL_FU.PARAL_DOWN then
return Z_AX() return Z_AX()
elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_TOP then elseif nOrthoOpposite == MCH_MILL_FU.ORTHO_TOP or nOrthoOpposite == MCH_MILL_FU.ORTUP_TOP or nOrthoOpposite == MCH_MILL_FU.PARAL_TOP then
return -Z_AX() return -Z_AX()
end end
return nil return nil
@@ -703,7 +706,7 @@ function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
if BD.C_SIMM or BD.TURN then if BD.C_SIMM or BD.TURN then
return -0.484 return -0.484
else else
if vtOrtho and vtOrtho:getZ() > 0.5 then if vtOrtho and vtOrtho:getZ() > 0.35 then
-- N_HorAng < 15° or N_HorAng > 55° -- N_HorAng < 15° or N_HorAng > 55°
if vtN and ( abs( vtN:getY()) < 0.259 or abs( vtN:getY()) > 0.819) then if vtN and ( abs( vtN:getY()) < 0.259 or abs( vtN:getY()) > 0.819) then
return -0.708 return -0.708
@@ -794,5 +797,255 @@ function BeamLib.GetChainSawInitAngs( vtN, vtO, nInd)
end end
end end
---------------------------------------------------------------------
-- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa. La faccia di indice (0 based) fctExclude non viene considerata nella ricerca.
function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude)
local nFaceIndMax = 0
local dMaxComp = 0
fctExclude = fctExclude or -1
for i = 1, Proc.Fct do
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT)
local dComp = abs( vtN * vtAx)
if dComp > dMaxComp and i ~= fctExclude + 1 then
nFaceIndMax = i -1
dMaxComp = dComp
end
end
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFaceIndMax, GDB_ID.ROOT)
return nFaceIndMax, ptC, vtN
end
---------------------------------------------------------------------
function BeamLib.GetTunnelDimension( Proc, nPartId)
-- sono necessarie almeno due facce
if Proc.Fct < 2 then return 0, 0, 0 end
-- recupero l'ingombro della trave
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- recupero centro e normale delle facce
local ptC = {}
local vtN = {}
for i = 1, Proc.Fct do
ptC[i], vtN[i] = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
end
-- calcolo l'orientamento del tunnel
local vtOrtho
local bAdj = EgtSurfTmFacetsContact( Proc.Id, 0, 1)
if bAdj then
vtOrtho = vtN[1] ^ vtN[2]
else
if Proc.Fct >= 3 then
vtOrtho = vtN[1] ^ vtN[3]
else
return 0, 0, 0
end
end
-- ottengo il boundingBox e prendo le dimensioni lungo la direzione (Z locale) che rappresenta la profondità della fessura
local frFc = Frame3d( ptC[1], vtOrtho) ;
local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc)
local dDepth = b3BoxLoc:getDimZ()
-- recupero gruppo per geometria addizionale
local nAddGrpId = BeamLib.GetAddGroup( nPartId)
if not nAddGrpId then
EgtOutLog( 'Error : missing AddGroup')
return 0, 0, 0
end
-- centro del bounding box locale
local ptCen = b3BoxLoc:getCenter()
ptCen:toGlob( frFc)
-- creo superficie intermedia
local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, ptCen, vtOrtho, b3Solid, GDB_ID.ROOT)
if not nSurfInt then return 0, 0, 0 end
-- ritaglio la superficie con le facce della fessura
for i = 1, Proc.Fct do
EgtCutSurfTmPlane( nSurfInt, ptC[i], -vtN[i], false, GDB_ID.ROOT)
end
local frSurfInt, dDimMax, dDimMin = EgtSurfTmFacetMinAreaRectangle( nSurfInt, 0, GDB_ID.ROOT)
-- cerco la faccia con larghezza pari a dimensione massima della fessura
local nLongIdFace = 0
for i = 1, Proc.Fct do
if abs( vtN[i] * frSurfInt:getVersX()) < 0.5 then
nLongIdFace = i - 1
break
end
end
return dDimMin, dDimMax, dDepth, vtOrtho, nLongIdFace, nSurfInt
end
---------------------------------------------------------------------
function BeamLib.CalcCollisionSafety( vtDir)
local dCollSic = 10 * BD.COLL_SIC
if abs( vtDir:getX()) > 0.999 or abs( vtDir:getY()) > 0.999 or abs( vtDir:getZ()) > 0.999 then
dCollSic = 0
elseif abs( vtDir:getX()) > 0.996 or abs( vtDir:getY()) > 0.996 or abs( vtDir:getZ()) > 0.996 then
dCollSic = 1 * BD.COLL_SIC
elseif abs( vtDir:getX()) > 0.89 or abs( vtDir:getY()) > 0.89 or abs( vtDir:getZ()) > 0.89 then
dCollSic = 2.5 * BD.COLL_SIC
elseif abs( vtDir:getX()) > 0.86 or abs( vtDir:getY()) > 0.86 or abs( vtDir:getZ()) > 0.86 then
dCollSic = 4 * BD.COLL_SIC
elseif abs( vtDir:getX()) > 0.707 or abs( vtDir:getY()) > 0.707 or abs( vtDir:getZ()) > 0.707 then
dCollSic = 5.5 * BD.COLL_SIC
end
return dCollSic
end
---------------------------------------------------------------------
function BeamLib.SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId, nStartPoint)
-- fondo tra loro le curve compatibili
EgtMergeCurvesInCurveCompo( nPathInt)
local nStartIdEnt, nNumEnt = EgtCurveDomain( nPathInt)
local pLastPIni, pLastPEnd
-- faccio una copia della curva e la esplodo
if nStartIdEnt then
-- prendo i punti
for i = 1, nNumEnt do
local pPini = EgtUP( nPathInt, (i-1), GDB_RT.GLOB)
local pPend = EgtUP( nPathInt, EgtIf( i == nNumEnt, 0, i), GDB_RT.GLOB)
-- Se normale lungo la Z considero il box in X e Y
if abs(vtOrtho:getZ()) > 0.999 then
-- se corrisponde a X
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
-- altrimenti se corrisponde a Y
elseif ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
-- altrimenti se normale lungo la Y considero il box in X e Z
elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getY()) > 0.999 then
-- se corrisponde a X
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
-- altrimenti se corrisponde a Z
elseif ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
-- caso che non dovrebbe mai capitare ma gestito per completezza
-- altrimenti se normale lungo la X considero il box in Y e Z
elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getX()) > 0.999 then
-- se corrisponde a Y
if ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
-- altrimenti se corrisponde a Z
elseif ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
-- se asse Z orizzontale verifico se si avvicina piú a Y
elseif abs(vtOrtho:getZ()) < 0.001 then
if abs(vtOrtho:getY()) > 0.75 then
-- se corrisponde a Z
if ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
end
-- se asse Y a 0 (fresa ne davanti ne dietro) verifico se si avvicina piú a Z+
elseif abs(vtOrtho:getY()) < 0.001 then
if abs(vtOrtho:getZ()) > 0.75 then
-- se corrisponde a Y
if ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
end
end
end
-- se devo cambiare il punto di partenza
if nStartPoint then
if pLastPIni and pLastPEnd then
-- calcolo il punto medio con gli ultimi punti utilizzati
local ptPs = ( pLastPIni + pLastPEnd) / 2
EgtChangeClosedCurveStartPoint( nPathInt, ptPs, GDB_RT.GLOB)
-- se devo eliminare la parte open
if nStartPoint == 2 then
EgtRemoveCurveCompoCurve( nPathInt, true)
EgtRemoveCurveCompoCurve( nPathInt, false)
return true
end
end
end
end
return false
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
return BeamLib return BeamLib
+17 -26
View File
@@ -1,6 +1,7 @@
-- MachiningLib.lua by Egaltech s.r.l. 2022/05/07 -- MachiningLib.lua by Egaltech s.r.l. 2022/05/07
-- Libreria ricerca lavorazioni per Travi -- Libreria ricerca lavorazioni per Travi
-- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste. -- 2022/05/07 ES Profonde modifiche per scelta ottimale lavorazioni in macchine con più teste.
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
-- Tabella per definizione modulo -- Tabella per definizione modulo
local MachiningLib = {} local MachiningLib = {}
@@ -110,24 +111,6 @@ local function SetCurrMachiningAndTool( sMachName)
return bActive, sTool, bH2, bFixed return bActive, sTool, bH2, bFixed
end end
---------------------------------------------------------------------
local function StartsWith( sStr, sStart)
if ( sStart == "" or sStr:sub( 1, #sStart) == sStart) then
return true, sStr:sub( 1, #sStr - #sStart)
else
return false, sStr
end
end
---------------------------------------------------------------------
local function EndsWith( sStr, sEnd)
if ( sEnd == "" or sStr:sub(-#sEnd) == sEnd) then
return true, sStr:sub(1, #sStr - #sEnd)
else
return false, sStr
end
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function VerifyDrill( dDiam, dDepth, bH2) function VerifyDrill( dDiam, dDepth, bH2)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
@@ -188,9 +171,9 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function VerifyTool( MachiningType, sType, Params, bH2) function VerifyTool( MachiningType, sType, Params, bH2)
if MachiningType == MCH_MY.DRILLING then if MachiningType == MCH_MY.DRILLING then
if StartsWith( sType, 'Drill') then if EgtStartsWith( sType, 'Drill') or EgtStartsWith( sType, 'AngleDrill') then
return VerifyDrill( Params.Diam, Params.Depth, bH2) return VerifyDrill( Params.Diam, Params.Depth, bH2)
elseif StartsWith( sType, 'Pocket') then elseif EgtStartsWith( sType, 'Pocket') then
return VerifyDrillPocket( Params.Diam, Params.Depth, bH2) return VerifyDrillPocket( Params.Diam, Params.Depth, bH2)
end end
elseif MachiningType == MCH_MY.SAWING then elseif MachiningType == MCH_MY.SAWING then
@@ -224,8 +207,8 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function ReturnParams( MachiningType, MachiningName, sType, ToolParams) function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
if MachiningType == MCH_MY.DRILLING then if MachiningType == MCH_MY.DRILLING then
local _, sOrigType = EndsWith( sType, '_H2') local _, sOrigType = EgtEndsWith( sType, '_H2')
return MachiningName, sType, EgtIf( sOrigType == 'Drill', ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'AngleDrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
elseif MachiningType == MCH_MY.SAWING then elseif MachiningType == MCH_MY.SAWING then
return MachiningName, ToolParams.H2 return MachiningName, ToolParams.H2
elseif MachiningType == MCH_MY.MILLING then elseif MachiningType == MCH_MY.MILLING then
@@ -266,9 +249,9 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
ForStep = -1 ForStep = -1
end end
if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then
_, sType = EndsWith( sType, '_H2') _, sType = EgtEndsWith( sType, '_H2')
elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then elseif ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bDownHead then
if not EndsWith( sType, '_H2') then if not EgtEndsWith( sType, '_H2') then
sType = sType .. '_H2' sType = sType .. '_H2'
end end
end end
@@ -284,7 +267,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
local Machining = Machinings[i] local Machining = Machinings[i]
local sMachiningType = Machining.Type local sMachiningType = Machining.Type
if BEAM and BEAM.BW then if BEAM and BEAM.BW then
_, sMachiningType = EndsWith( Machining.Type, '_H2') _, sMachiningType = EgtEndsWith( Machining.Type, '_H2')
end end
-- recupero dati utensile -- recupero dati utensile
local bToolActive, sToolName, bH2, bFixed = SetCurrMachiningAndTool( Machining.Name) local bToolActive, sToolName, bH2, bFixed = SetCurrMachiningAndTool( Machining.Name)
@@ -355,7 +338,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
end end
end end
end end
local bH2, sOrigType = EndsWith( sType, '_H2') local bH2, sOrigType = EgtEndsWith( sType, '_H2')
if ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then if ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then
return FindMachining( MachiningType, sOrigType, Params, true, false) return FindMachining( MachiningType, sOrigType, Params, true, false)
end end
@@ -377,6 +360,14 @@ function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead)
end end
end end
---------------------------------------------------------------------
function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5 = FindMachining( MCH_MY.DRILLING, 'AngleDrill', { Diam = dDiam, Depth = dDepth}, bTopHead, bDownHead)
if MachiningName and MachiningName ~= '' then
return MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5
end
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead) function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead)
return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead) return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead)
+40 -21
View File
@@ -1,4 +1,4 @@
-- ProcessCut.lua by Egaltech s.r.l. 2022/06/28 -- ProcessCut.lua by Egaltech s.r.l. 2022/07/28
-- Gestione calcolo singoli tagli di lama per Travi -- Gestione calcolo singoli tagli di lama per Travi
-- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito. -- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito.
-- 2021/06/06 Correzioni per tagli con testa da sotto. -- 2021/06/06 Correzioni per tagli con testa da sotto.
@@ -11,6 +11,11 @@
-- 2022/05/31 Alcune modifiche per utilizzare la ProcessCut.Make in ProcessSplit e ProcessHeadCut, per le sezioni alte e larghe. -- 2022/05/31 Alcune modifiche per utilizzare la ProcessCut.Make in ProcessSplit e ProcessHeadCut, per le sezioni alte e larghe.
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe). -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe).
-- 2022/06/28 Modificata determinazione taglio bFromBottom in MakeFromTop. -- 2022/06/28 Modificata determinazione taglio bFromBottom in MakeFromTop.
-- 2022/07/18 Se Q04=1, aggiunto LongCut anche dal lato per macchine tipo PF1250.
-- 2022/08/12 I tagli di lama inclinati in coda ora partono dal centro e non dall'esterno.
-- 2022/08/24 Disabilitato il dicing per i tagli meno spessi della lama.
-- 2022/08/25 In caso di AdvTail con taglio lungo Y la profondità di lavorazione è opportunamente diminuita.
-- 2022/08/30 Modificata la condizione che determina l'utilizzo della testa da sotto. Ora controlla se la trave è più grande del doppio della massima larghezza del cubetto.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessCut = {} local ProcessCut = {}
@@ -243,9 +248,18 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and local bLongCut = ( not bDownCut and vtN:getZ() > 0.865 and
Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000)) ( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
-- verifico se da considerare taglio lungo dal lato, solo per macchine tipo PF1250, inclinato non più di 30deg
local bLongCutFromSide = ( not bDownCut and ( BD.C_SIMM and BD.DOWN_HEAD and ( vtN:getY() > 0.865 or vtN:getY() < -0.865) and
Proc.Box:getDimZ() > b3Solid:getDimZ() - 10 * GEO.EPS_SMALL) and
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
-- se taglio lungo e Q04 = 1 allora lancio il processo dell'L10 -- se taglio lungo e Q04 = 1 allora lancio il processo dell'L10
if bLongCut and EgtGetInfo( Proc.Id, 'Q04', 'i') == 1 then local bNoDicing = EgtGetInfo( Proc.Id, 'Q04', 'i') == 1
return LongCut.Make( Proc, nPhase, nRawId, nPartId, true) if bNoDicing then
if bLongCut then
return LongCut.Make( Proc, nPhase, nRawId, nPartId, true)
elseif bLongCutFromSide then
return LongCut.Make( Proc, nPhase, nRawId, nPartId, false, 2)
end
end end
-- se pezzo ancora attaccato alla trave, per non rovinare quello successivo -- se pezzo ancora attaccato alla trave, per non rovinare quello successivo
local bFillAreaPiece local bFillAreaPiece
@@ -312,7 +326,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- determino la direzione di taglio preferenziale -- determino la direzione di taglio preferenziale
local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA and not bDownCut) local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA and not bDownCut) or
( dCutV < 0.8 * dMaxVertDepth - BD.CUT_EXTRA and b3Solid:getDimZ() < 0.8 * dMaxVertDepth - BD.CUT_EXTRA)
local bVertCutOk = ( dCutH < dMaxDepth - BD.CUT_EXTRA) local bVertCutOk = ( dCutH < dMaxDepth - BD.CUT_EXTRA)
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId) local nAddGrpId = BL.GetAddGroup( nPartId)
@@ -333,10 +348,13 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
vtExtra = X_AX() vtExtra = X_AX()
bAutoCalcSurf = false bAutoCalcSurf = false
end end
vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA) -- se il taglio è più spesso della lama abilito il dicing, altrimenti no
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate if Proc.Box:getDimX() >= dSawThick then
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY()) -- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
end
end end
end end
-- se il ProcessCut viene lanciato dal ProcessSawCut e non ci sono tagli a cubetti, esco -- se il ProcessCut viene lanciato dal ProcessSawCut e non ci sono tagli a cubetti, esco
@@ -392,14 +410,12 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
else else
if bHorizCut then if bHorizCut then
vtOrthoO = Z_AX() vtOrthoO = Z_AX()
elseif vtN:getY() > -0.02 then
if not Proc.Head then
vtOrthoO = -Y_AX()
else
vtOrthoO = Y_AX()
end
else else
vtOrthoO = -Y_AX() if vtN:getZ() < dNzLimDwnUp then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
end
end end
end end
end end
@@ -457,7 +473,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
local vtOrthoO local vtOrthoO
if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then
vtOrthoO = -Z_AX() vtOrthoO = -Z_AX()
elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or vtN:getX() > 0) then elseif bHorizCut and ( not bVertCutOk or b3Solid:getDimX() > BD.LEN_SHORT_PART or Proc.AdvTail or vtN:getX() > 0 or ( abs( vtN:getY()) < 0.1 and vtN:getZ() <= 0)) then
vtOrthoO = Z_AX() vtOrthoO = Z_AX()
elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and elseif b3Solid:getDimX() < BD.LEN_SHORT_PART and not Proc.AdvTail and abs( vtN:getY()) > 0.259 and
vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then vtN:getZ() > -0.174 and abs( vtN:getY()) > abs( vtN:getZ()) and dCutH < dMaxDepth + 10 * GEO.EPS_SMALL then
@@ -472,14 +488,17 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
else else
vtOrthoO = -X_AX() vtOrthoO = -X_AX()
end end
elseif Proc.Head then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
else else
if vtN:getZ() < dVzLimDwnUp then if vtN:getZ() < dVzLimDwnUp or Proc.Head or Proc.Tail then
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX()) vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
else else
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX()) vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
end end
-- se è una lavorazione da anticipare diminuisco la profondità del taglio per evitare collisioni con l'albero della lama
if Proc.AdvTail then
local _, dH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
dCutExtra = min( -BD.ADVANCE_TAIL_OFFS, -dH + dMaxDepth)
end
end end
-- taglio -- taglio
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
@@ -704,9 +723,9 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
return true return true
end end
end end
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione larga o pezzo corto) -- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione più larga di 2 cubetti o pezzo corto)
local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and
( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART)) ( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_DICE - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART))
local bDownTurn = ( BD.TURN and vtN:getZ() < -0.017) local bDownTurn = ( BD.TURN and vtN:getZ() < -0.017)
local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead)) local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead))
-- recupero la lavorazione -- recupero la lavorazione
+313
View File
@@ -1,5 +1,6 @@
-- ProcessDoubleCut.lua by Egaltech s.r.l. 2022/07/11 -- ProcessDoubleCut.lua by Egaltech s.r.l. 2022/07/11
-- Gestione calcolo doppi tagli di lama per Travi -- Gestione calcolo doppi tagli di lama per Travi
-- 2022/08/29 Implementata la fresatura dal lato per tagli problematici per PF1250
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDoubleCut = {} local ProcessDoubleCut = {}
@@ -188,6 +189,293 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
return true return true
end end
---------------------------------------------------------------------
local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketDown)
-- tipo di svuotatura
local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket')
-- ricerca della svuotatura
local sPocketing
if dDepth then
sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
else
sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
end
if not sPocketing then
return false
end
-- recupero i dati dell'utensile
local bUsePocketing = false
local dMaxDepth = 0
local dToolDiam = 0
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
bUsePocketing = true
end
return bUsePocketing, sPocketing, dMaxDepth, dToolDiam
end
---------------------------------------------------------------------
local function SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId)
-- fondo tra loro le curve compatibili
EgtMergeCurvesInCurveCompo( nPathInt)
local nStartIdEnt, nNumEnt = EgtCurveDomain( nPathInt)
local pLastPIni, pLastPEnd
-- faccio una copia della curva e la esplodo
if nStartIdEnt then
-- ciclo i lati della curva e controllo per ognuno se giace in uno dei piani limite del pezzo: se sì allora il lato è aperto
for i = 1, nNumEnt do
local pPini = EgtUP( nPathInt, (i-1), GDB_RT.GLOB)
local pPend = EgtUP( nPathInt, EgtIf( i == nNumEnt, 0, i), GDB_RT.GLOB)
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
-- scrivo nelle proprietà della curva quali sono i lati aperti
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
-- se ci sono già altri lati aperti
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
-- se è l'unico
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
end
end
end
return false
end
---------------------------------------------------------------------
local function MakeBySidePocket( Proc, nPhase, nRawId, nPartId, nAddGrpId, b3Solid)
local nFirstMachId
local sWarn
local sMchFind = 'OpenPocket'
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt
local bBadMach = false
-- ottengo le dimensioni del tunnel
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
-- posso utilizzare utensile con diametro doppio della dimensione minima
dDimMin = min( 2 * dDimMin, BD.MAXDIAM_POCK_CORNER)
local nPathInt
-- verifico se è presente la testa da sotto e se è necessario usarla
bMillDown = ( BD.DOWN_HEAD == true and abs( vtOrtho:getZ()) >= 0.707)
-- cerco l'utensile di svuotatura per la testa sopra
local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind)
local bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn
-- cerco anche l'utensile per la testa sotto, nel caso servisse
if bMillDown then
bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind, true)
-- se è negativo inverto il versore e la faccia
if vtOrtho:getZ() < 0 then
vtOrtho = -vtOrtho
EgtInvertSurf( nSurfInt)
end
end
if bMakePocket then
-- gestione svuotatura da un solo lato o anche dal lato opposto (se non verticale)
-- estraggo il contorno dalla superfice per evitare i problemi con la svuotatura
-- e assegno l'estrusione
nPathInt = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId)
EgtModifyCurveExtrusion( nPathInt, vtOrtho, GDB_RT.GLOB)
SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId)
-- variabili per parametri lavorazione
local dMachDepth
local dElev = 0
local bDoubleSide
local bOneShot
local bComplete = true
-- imposto altezza aggiuntiva di elevazione
local dCollSic = BL.CalcCollisionSafety( vtOrtho)
-- se possibile svuotare completamente da una sola parte
if dMaxDepth > ( dDepth + BD.CUT_EXTRA + dCollSic) then
dMachDepth = ( dDepth / 2) + BD.CUT_EXTRA
dElev = dDepth + BD.CUT_EXTRA
bOneShot = true
else
-- se direzione verso la verticale setto max affondamento possibile ed
-- emetto messaggio di warning perché non lavorabile interamente
if abs( vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
dElev = dMaxDepth
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
bComplete = false
-- altrimenti setto il flag per fare la svuotatura da due parti
else
-- se l'altezza utensile riesce a lavorare completamente da due parti
if dMaxDepth > ( dDepth / 2) + dCollSic + BD.CUT_EXTRA_MIN then
dMachDepth = BD.CUT_EXTRA_MIN
dElev = ( dDepth / 2) + BD.CUT_EXTRA_MIN
-- altrimenti non si riesce in due passate, limito la profondità e setto l'elevazione
else
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
dElev = dMaxDepth
-- se molto inclinato rispetto alla normale della faccia di riferimento, lavorazione non idonea per probabili collisioni
local vtRef = Y_AX()
if abs( vtOrtho:getX()) > abs( vtOrtho:getY()) and abs( vtOrtho:getX()) > abs( vtOrtho:getZ()) then
vtRef = X_AX()
elseif abs( vtOrtho:getZ()) > abs( vtOrtho:getX()) and abs( vtOrtho:getZ()) > abs( vtOrtho:getY()) then
vtRef = Z_AX()
end
if abs( vtOrtho * vtRef) < 0.5 then
bBadMach = true
end
end
bDoubleSide = true
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return -1, sErr
end
-- prendo l'id della prima lavorazione inserita
if not nFirstMachId then
nFirstMachId = nMchFId
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nPathInt, -1}})
-- verifico se devo invertire direzione utensile (in caso di direzione verso la verticale)
local bInvertMach
if vtOrtho:getZ() < BD.NZ_MINA and abs(vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
bInvertMach = true
-- altrimenti se da fare in una sola volta e direzionato verso Y+ lo inverto per lavorarlo davanti
elseif not bDoubleSide and vtOrtho:getY() > GEO.EPS_SMALL and not ( -(vtOrtho:getZ()) < BD.NZ_MINA) then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
bInvertMach = true
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if AreSameOrOppositeVectorApprox( vtOrtho, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtOrtho:getX()) < 0.1 then
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtOrtho:getY() < GEO.EPS_SMALL then
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
-- inverto il percorso di lavorazione per lavorare sinistro
EgtSetMachiningParam( MCH_MP.INVERT, true)
-- imposto affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return -1, sErr
end
end
-- se posso applicare la svuotatura sul lato opposto
if bDoubleSide then
-- se ho la lavorazione da sotto ricalcolo in base a questa lavorazione
if bMakePocketDn then
-- sPocketing = sPocketingDn
-- dMaxDepth = dMaxDepthDn
-- dDiamTool = dDiamToolDn
-- se l'altezza utensile riesce a lavorare completamente da due parti
if dMaxDepthDn > ( dDepth / 2) + dCollSic + BD.CUT_EXTRA_MIN then
dMachDepth = BD.CUT_EXTRA_MIN
dElev = ( dDepth / 2) + BD.CUT_EXTRA_MIN
-- altrimenti non si riesce in due passate, limito la profondità e setto l'elevazione
else
dMachDepth = dMaxDepthDn - ( dDepth / 2) - dCollSic
dElev = dMaxDepthDn
bComplete = false
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
else
-- se anche lavorando dal lato opposto non riesco a svuotare completamente la fessura
-- setto i parametri affondamento ed emetto warning
if dMaxDepth < ( dDepth / 2) + BD.CUT_EXTRA + dCollSic then
dMachDepth = dMaxDepth - (dDepth / 2) - dCollSic
dElev = dMaxDepth
bComplete = false
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'PockOppo_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, EgtIf( bMakePocketDn, sPocketingDn, sPocketing))
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. EgtIf( bMakePocketDn, sPocketingDn, sPocketing)
EgtOutLog( sErr)
return -1, sErr
end
-- prendo l'id della prima lavorazione inserita
if not nFirstMachId then
nFirstMachId = nMchFId
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nPathInt, -1}})
-- imposto direzione utensile opposta
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE
if not BD.C_SIMM then
if AreSameVectorApprox( vtOrtho, Z_AX()) then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtOrtho:getX()) < 0.1 then
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
elseif vtOrtho:getY() < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YP
else
nSCC = MCH_SCC.ADIR_YM
end
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
-- inverto il percorso di lavorazione per lavorare sinistro
EgtSetMachiningParam( MCH_MP.INVERT, true)
-- imposo affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
-- imposto elevazione e dichiaro non si generano sfridi per VMill
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
sNotes = sNotes .. 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- eseguo
if not ML.ApplyMachining( true, false) then
-- provo ad allargare leggermente la tasca
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return -1, sErr
end
end
end
return 1, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId
end
return 0, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId, bOrthoFaces
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
@@ -273,6 +561,31 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- eseguo -- eseguo
local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide') local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide')
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < BD.NZ_MINB) local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < BD.NZ_MINB)
-- per tutte le macchine tranne la Fast, controllo se ci sono tagli troppo inclinati e troppo profondi per la lama
-- in tal caso richiamo la lavorazione con fresa dal lato
if BD.C_SIMM and not bDownHead then
local sCutting = ML.FindCutting( sCutType, nil, bDownHead)
if not sCutting then
local sErr = 'Error : cutting not found in library'
EgtOutLog( sErr)
return false, sErr
end
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sCutting) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
local _, _, dDimV1 = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
local _, _, dDimV2 = BL.GetFaceHvRefDim( Proc.Id, 1, b3Raw)
local bFace1TooLongForBlade, bFace2TooLongForBlade = ( dDimV1 >= dMaxDepth), ( dDimV2 >= dMaxDepth)
local dFace1Ang, dFace2Ang = vtN[1]:getZ(), vtN[2]:getZ()
if bFace1TooLongForBlade and dFace1Ang < ( BD.CUT_VZ_MIN or -0.485) or bFace2TooLongForBlade and dFace2Ang < ( BD.CUT_VZ_MIN or -0.485) then
local bOk, sErr = MakeBySidePocket( Proc, nPhase, nRawId, nPartId, nAddGrpId, b3Solid)
return bOk, sErr
end
end
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead) local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead)
if not bOk then return bOk, sErr end if not bOk then return bOk, sErr end
-- segnalazione ingombro di testa o coda -- segnalazione ingombro di testa o coda
+123 -111
View File
@@ -1,4 +1,4 @@
-- ProcessDrill.lua by Egaltech s.r.l. 2022/04/21 -- ProcessDrill.lua by Egaltech s.r.l. 2022/08/18
-- Gestione calcolo forature per Travi -- Gestione calcolo forature per Travi
-- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile. -- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile.
-- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto. -- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto.
@@ -11,6 +11,8 @@
-- 2022/07/01 Aggiunta gestione allungamento percorsi fori in caso di materiale già rimosso da lavorazioni precedenti -- 2022/07/01 Aggiunta gestione allungamento percorsi fori in caso di materiale già rimosso da lavorazioni precedenti
-- 2022/07/07 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda che tagliano tutta la sezione; gli Id delle feature sono nelle proprietà MachineAfterHeadCutId e MachineAfterTailCutId. -- 2022/07/07 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda che tagliano tutta la sezione; gli Id delle feature sono nelle proprietà MachineAfterHeadCutId e MachineAfterTailCutId.
-- 2022/07/12 Aggiunto un valore minimo (10) per la distanza di sicurezza. -- 2022/07/12 Aggiunto un valore minimo (10) per la distanza di sicurezza.
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto e punta disabilitata.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDrill = {} local ProcessDrill = {}
@@ -168,9 +170,43 @@ function ProcessDrill.Classify( Proc, b3Raw)
end end
end end
---------------------------------------------------------------------
-- Funzione per riconoscimento faccia inizio foro e dati correlati
-- Indice faccia :1=Front, 2=Bottom, 3=Back, 4=Top, 5=Left, 6=Right
local function GetHoleStartData( ptCen, vtExtr, b3Solid)
-- Facce della trave
local vFaces = { { Dist = -b3Solid:getMin():getY(), Norm = -Y_AX()},
{ Dist = -b3Solid:getMin():getZ(), Norm = -Z_AX()},
{ Dist = b3Solid:getMax():getY(), Norm = Y_AX()},
{ Dist = b3Solid:getMax():getZ(), Norm = Z_AX()},
{ Dist = -b3Solid:getMin():getX(), Norm = -X_AX()},
{ Dist = b3Solid:getMax():getX(), Norm = X_AX()}}
-- Ricerca della faccia di inizio
local nFac = 0
local dCosMin = 0.0871
for i = 1, 6 do
if ( ptCen - ORIG()) * vFaces[i].Norm - vFaces[i].Dist > -2 then
local dCos = vtExtr * vFaces[i].Norm
if dCos > dCosMin then
nFac = i
dCosMin = dCos
if dCos > 0.7072 then break end
end
end
end
-- Coseno angolo dalla faccia
local CosB = 0
if nFac ~= 0 then
CosB = sqrt( 1 - sqr( vtExtr * vFaces[nFac].Norm))
end
return nFac, CosB, vFaces
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- default per costanti
BD.DRILL_VX_MAX_ANGLEDRILL = ( BD.DRILL_VX_MAX_ANGLEDRILL or 0.928)
-- ingombro del pezzo -- ingombro del pezzo
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then if not b3Solid then
@@ -189,21 +225,34 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- recupero i dati del foro -- recupero i dati del foro
local dDiam = 2 * EgtArcRadius( AuxId) local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId)) local dLen = abs( EgtCurveThickness( AuxId))
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
if Proc.Flg == -2 then vtExtr = - vtExtr end if Proc.Flg == -2 then
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
end
local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0) local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0)
-- verifico possibilità di foratura da sotto
local bDownDrill = ( BD.DOWN_HEAD and ML.FindDrilling( dDiam, nil, false, true))
-- verifico che il foro non sia fattibile solo da sotto -- verifico che il foro non sia fattibile solo da sotto
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN) and not BD.DOWN_HEAD local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill)
if bToInvert and ( not bOpen or Proc.Flg ~= 1) then if bToInvert and ( not bOpen or Proc.Flg ~= 1) then
local sErr = 'Error : drilling from bottom impossible' local sErr = 'Error : drilling from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- se il foro è cieco o troppo inclinato all'inizio, lo inverto -- se non già richiesta inversione e invertibile
if Proc.Fcs == 0 or ( abs( vtExtr:getX()) > BD.DRILL_VX_MAX and Proc.Fcs ~= 5 and Proc.Fcs ~= 6) then if not bToInvert and Proc.Flg == 1 and ( -vtExtr:getZ() >= BD.DRILL_VZ_MIN or bDownDrill) then
bToInvert = true -- se il foro è cieco o troppo inclinato all'inizio, lo inverto
local _, CosB, _ = GetHoleStartData( ptCen, vtExtr, b3Solid)
if Proc.Fcs == 0 or ( CosB > BD.DRILL_VX_MAX and bOpen) then
bToInvert = true
end
end
if bToInvert then
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
end end
if bToInvert then vtExtr = - vtExtr end
-- se foro è splittato ed è la parte opposta, inverto -- se foro è splittato ed è la parte opposta, inverto
if Proc.Flg == -2 then bToInvert = true end if Proc.Flg == -2 then bToInvert = true end
-- profondità geometrica del foro -- profondità geometrica del foro
@@ -216,8 +265,8 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
local dCheckDepth2 = dDepth2 local dCheckDepth2 = dDepth2
local nErrorCode = 0 local nErrorCode = 0
-- abilitazione foratura da sotto -- abilitazione foratura da sotto
local bDrillDown = ( BD.DOWN_HEAD and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259)) local bDrillDown = ( bDownDrill and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259))
local bDrillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259) local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.5)
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante -- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
-- recupero la lavorazione -- recupero la lavorazione
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown) local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
@@ -279,6 +328,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
local bCommonCompare = BD.MAX_TOOL_LEN_BACK_HOR_MACH and bOpen and abs(vtExtr:getX()) < 0.5 and abs(vtExtr:getZ()) < 0.5 local bCommonCompare = BD.MAX_TOOL_LEN_BACK_HOR_MACH and bOpen and abs(vtExtr:getX()) < 0.5 and abs(vtExtr:getZ()) < 0.5
if nErrorCode == 0 and not bToInvert and bCommonCompare and vtExtr:getY() > 0.866 and Proc.Flg == 1 and dMaxToolLength > BD.MAX_TOOL_LEN_BACK_HOR_MACH then if nErrorCode == 0 and not bToInvert and bCommonCompare and vtExtr:getY() > 0.866 and Proc.Flg == 1 and dMaxToolLength > BD.MAX_TOOL_LEN_BACK_HOR_MACH then
bToInvert = true bToInvert = true
ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr vtExtr = - vtExtr
--------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -297,8 +347,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
dToolFreeLen = dToolFreeLen2 dToolFreeLen = dToolFreeLen2
dDepth = dDepth2 dDepth = dDepth2
if vtExtr:getY() > 0 then if vtExtr:getY() > 0 then
bToInvert = true bToInvert = true
vtExtr = - vtExtr ptCen = ptCen - vtExtr * dLen
vtExtr = - vtExtr
end end
-- se sono al secondo mezzo foro con utensile che supera la lunghezza di riferimento non lo eseguo -- se sono al secondo mezzo foro con utensile che supera la lunghezza di riferimento non lo eseguo
elseif nErrorCode == 0 and bCommonCompare and abs(vtExtr:getY()) > 0.866 and Proc.Flg == -2 and dMaxToolLength2 > BD.MAX_TOOL_LEN_BACK_HOR_MACH then elseif nErrorCode == 0 and bCommonCompare and abs(vtExtr:getY()) > 0.866 and Proc.Flg == -2 and dMaxToolLength2 > BD.MAX_TOOL_LEN_BACK_HOR_MACH then
@@ -313,55 +364,64 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- conservo il valore originale di MaxDepth per poter eventualmente bypassare i check successivi -- Determino la faccia di inizio del foro e dati correlati
local nFac, CosB, vFaces = GetHoleStartData( ptCen, vtExtr, b3Solid)
-- Calcolo acciorciamento affondamento utile per evitare collisione portautensile con faccia
local TgA = CosB / sqrt( 1 - CosB * CosB)
local dSubL = ( dDiamTh / 2 + ( Proc.Diam - dToolDiam) / 2 + 2) * TgA
local dMaxDepthOri = dMaxDepth local dMaxDepthOri = dMaxDepth
-- verifico il massimo affondamento dMaxDepth = min( dMaxDepth, dToolFreeLen - dSubL)
local dSubL1 = 0 -- Verifico inclinazione foro nei limiti
local dSubL2 = 0 local bTryDrill = ( CosB < BD.DRILL_VX_MAX)
local dSubL3 = 0 if ( CosB > 0.8 * BD.DRILL_VX_MAX and CosB < BD.DRILL_VX_MAX_ANGLEDRILL) then
local dDeltaRad = ( Proc.Diam - dToolDiam) / 2 -- cerco le forature speciali AngleDrill
-- se foro non su testa o coda e inclinato local sDrilling3, sType3, dMaxDepth3 = ML.FindAngleDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
local bInMid = false if sDrilling3 then
local bInvertFcse = ( bToInvert and Proc.Flg ~= -2) sDrilling = sDrilling3
if ( not bInvertFcse and Proc.Fcs ~= 5 and Proc.Fcs ~= 6) or ( bInvertFcse and Proc.Fce ~= 5 and Proc.Fce ~= 6) then sType = sType3
bInMid = true dMaxDepth = dMaxDepth3
local CosB = abs( vtExtr:getX()) bTryDrill = true
if CosB < BD.DRILL_VX_MAX then
local TgA = CosB / sqrt( 1 - CosB * CosB)
dSubL1 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA
else
dMaxDepth = 0
end end
end end
-- se foro davanti o dietro e inclinato -- aggiusto affondamento e MaxElev
if dMaxDepth > 0 and abs( vtExtr:getY()) > abs( vtExtr:getZ()) then local dMaxElev
local CosB = abs( vtExtr:getY()) local sMyWarn
if bInMid then -- se c'è un taglio precedente di testa o coda in cui il foro "entra" devo ricalcolare i dati della foratura
CosB = sqrt( vtExtr:getZ() * vtExtr:getZ() + vtExtr:getX() * vtExtr:getX()) if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then
end local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB)
if CosB < BD.DRILL_VX_MAX then if bIntersectionOk then
local TgA = CosB / sqrt( 1 - CosB * CosB) local dHoleToCutDistance = vDistance[1]
dSubL2 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA -- se il taglio accorcia realmente il foro
else if dHoleToCutDistance > 10 * GEO.EPS_SMALL and dHoleToCutDistance < dLen then
dMaxDepth = 0 dMaxDepth = dMaxDepthOri
dMaxElev = dLen - dHoleToCutDistance
bTryDrill = true
local dToolAddLength = dLen - dMaxElev
-- se l'utensile è comunque troppo corto lavoro il massimo possibile
if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dLen
else
-- se è un foro splittato cerco comunque di arrivare alla massima profondità possibile, evitando di sfondare dall'altro lato.
if Proc.Flg == 2 or Proc.Flg == -2 then
dDepth = dLen - 10
end
-- se non lavoro la massima lunghezza disponibile devo correggere MaxElev
dMaxElev = dMaxElev - dLen + dDepth
end
end
end end
end end
-- se foro sopra o sotto e inclinato -- se foro da saltare per eccessiva inclinazione
if dMaxDepth > 0 and abs( vtExtr:getZ()) > abs( vtExtr:getY()) then if not bTryDrill then
local CosB = abs( vtExtr:getZ()) sMyWarn = 'Warning in drill : too slant hole'
if bInMid then dDepth = 0
CosB = sqrt( vtExtr:getY() * vtExtr:getY() + vtExtr:getX() * vtExtr:getX()) return true, sMyWarn
end -- se non ridotto e affondamento richiesto supera il consentito
if CosB < BD.DRILL_VX_MAX then elseif not dMaxElev and dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
local TgA = CosB / sqrt( 1 - CosB * CosB) sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dSubL3 = ( dDiamTh / 2 + dDeltaRad + 2) * TgA dDepth = dMaxDepth
else dMaxElev = dMaxDepth
dMaxDepth = 0
end
end
local dSubL = max( dSubL1, dSubL2, dSubL3)
if dMaxDepth > 0 then
dMaxDepth = min( dMaxDepth, dToolFreeLen - dSubL)
end end
-- inserisco la lavorazione -- inserisco la lavorazione
local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local sName = 'Drill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
@@ -374,7 +434,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) EgtSetMachiningGeometry( {{ AuxId, -1}})
-- eventuale inversione -- eventuale inversione
if sType == 'Drill' or sType == 'Drill_H2' then if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, bToInvert) EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
else else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert) EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
@@ -396,57 +456,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
nSCC = MCH_SCC.NONE nSCC = MCH_SCC.NONE
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC) EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- aggiusto affondamento e MaxElev -- imposto affondamento
local dMaxElev = dDepth
local sMyWarn
if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
-- se c'è un taglio precedente di testa o coda posso impostare MaxElev per allungare il percorso
-- considero solo i fori "entranti" in testa o coda
if (( Proc.MachineAfterHeadCutId and vtExtr:getX() > 0) or ( Proc.MachineAfterTailCutId and vtExtr:getX() < 0)) then
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
local bIntersectionOk, _, vDistance = EgtLineSurfTmInters( ptCen, -vtExtr, Proc.MachineAfterHeadCutId or Proc.MachineAfterTailCutId, GDB_RT.GLOB)
dHoleToCutDistance = vDistance[1]
-- setto MaxElev
-- il segno della distanza data dalla funzione di intersezione mi indica dove sia la geometria del foro
if bIntersectionOk then
-- se MaxDepth era stato settato a 0 per disattivare la lavorazione gli riassegno il valore originale
if dMaxDepth == 0 then
dMaxDepth = dMaxDepthOri
end
if dHoleToCutDistance > 10 * GEO.EPS_SMALL then
dMaxElev = dLen - dHoleToCutDistance
elseif dHoleToCutDistance < -10 * GEO.EPS_SMALL then
dMaxElev = -dHoleToCutDistance
end
local dToolAddLength = dLen - dMaxElev
-- se l'utensile è comunque troppo corto lavoro il massimo possibile
if dDepth - dToolAddLength > dMaxDepth + 10 * GEO.EPS_SMALL then
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth - dToolAddLength, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dLen
else
-- se è un foro splittato cerco comunque di arrivare alla massima profondità possibile, evitando di sfondare dall'altro lato.
if Proc.Flg == 2 or Proc.Flg == -2 then
dDepth = dLen - 10
end
-- se non lavoro la massima lunghezza disponibile devo correggere MaxElev
dMaxElev = dMaxElev - dLen + dDepth
end
-- se per qualche motivo fallisce l'intersezione torno al caso standard
else
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dMaxDepth
dMaxElev = dMaxDepth
end
-- caso standard
else
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dMaxDepth
dMaxElev = dMaxDepth
end
if sMyWarn then
EgtOutLog( sMyWarn)
end
end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10. -- imposto il valore della distanza di sicurezza per l'attacco. Se il valore del db utensili è troppo basso lo alzo a 10.
local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS) local dToolDbStartPos = EgtGetMachiningParam( MCH_MP.STARTPOS)
@@ -456,9 +466,11 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill -- Note utente con dichiarazione nessuna generazione sfridi per Vmill
local sUserNotes = 'VMRS=0;' local sUserNotes = 'VMRS=0;'
-- aggiungo alle note massima elevazione (coincide con affondamento) -- aggiungo alle note massima elevazione (coincide con affondamento)
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';' if dMaxElev then
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';'
end
-- se foro passante, aggiungo questa qualifica alle note -- se foro passante, aggiungo questa qualifica alle note
if ( sType == 'Drill' or sType == 'Drill_H2') and bOpen then if ( sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill') and bOpen then
sUserNotes = sUserNotes .. 'Open=1;' sUserNotes = sUserNotes .. 'Open=1;'
end end
-- se lavorazione in doppio -- se lavorazione in doppio
@@ -470,8 +482,8 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo -- eseguo
local bOk = ML.ApplyMachining( true, false) local bOk = ML.ApplyMachining( true, false)
if not bOk and BD.DOWN_HEAD then if not bOk and bDownDrill then
if sType == 'Drill' or sType == 'Drill_H2' then if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
else else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
+4 -2
View File
@@ -1,4 +1,4 @@
-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/06/07 -- ProcessDtMortise.lua by Egaltech s.r.l. 2022/08/18
-- Gestione calcolo mortase a coda di rondine per Travi -- Gestione calcolo mortase a coda di rondine per Travi
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
-- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto. -- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto.
@@ -6,6 +6,7 @@
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST. -- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda). -- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
-- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali. -- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali.
-- 2022/08/18 Migliorato calcolo dello step.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessDtMortise = {} local ProcessDtMortise = {}
@@ -430,7 +431,8 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local dDist = min( vtOrtDiff:len(), dWidthMrt) local dDist = min( vtOrtDiff:len(), dWidthMrt)
-- calcolo le passate -- calcolo le passate
local nPass = ceil( dDist / ( 1.9 * dToolDiam)) local nPass = ceil( dDist / ( 1.9 * dToolDiam))
local dStep = ( dDist - 0.95 * dToolDiam) / ( 2 * nPass) local dStep = 0
if nPass > 1 then dStep = max( ( dDist - 2 * dToolDiam) / ( 2 * nPass - 2), 0.25 * dToolDiam) end
for i = nPass, 1, -1 do for i = nPass, 1, -1 do
-- inserisco la lavorazione di contornatura -- inserisco la lavorazione di contornatura
local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass) local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass)
+85 -4
View File
@@ -1,5 +1,6 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/07 -- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/07
-- Gestione calcolo profilo libero per Travi -- Gestione calcolo profilo libero per Travi
-- 2022/08/23 Aggiunta la funzione MakeByMark per la gestione del caso P13=10
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessFreeContour = {} local ProcessFreeContour = {}
@@ -233,14 +234,16 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
local dDepth = abs( EgtCurveThickness( AuxId)) local dDepth = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD) local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
local bToolInv = ( vtExtr:getZ() < -0.1) local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
local bDown = ( b3Aux:getMin():getZ() < b3Raw:getMin():getZ() + 5) local bDown = ( b3Aux:getMin():getZ() < b3Raw:getMin():getZ() + 5)
-- verifico se in testa o coda -- verifico se in testa o coda
local bHead = Proc.Head local bHead = Proc.Head
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva -- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true) local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
-- recupero la lavorazione -- recupero la lavorazione
local sMilling = ML.FindMilling( 'FreeContour') local bTopHead = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.1)
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
local sMilling = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, bTopHead, bDownHead)
if not sMilling then if not sMilling then
local sErr = 'Error : FreeContour not found in library' local sErr = 'Error : FreeContour not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
@@ -688,6 +691,76 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
return true return true
end end
---------------------------------------------------------------------
local function MakeByMark( Proc, nRawId, b3Raw, nPartId)
-- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sErr = 'Error : part box not found'
EgtOutLog( sErr)
return false, sErr
end
-- recupero e verifico l'entità curva
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Error : missing profile geometry'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati della curva e del profilo
local dDepth = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
-- recupero la lavorazione
local sMillType = 'Text'
--local sMchExt = EgtIf( bMillDown, '_H2', '')
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
if not sMilling then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione
local sName = 'FreeMark_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sMilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchId, 'Part', Proc.PartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- se estrusione da sotto, inverto direzione fresa
if bToolInv then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
-- posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_ZP
if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
return true
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
@@ -698,7 +771,15 @@ function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
return MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead) return MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
-- altrimenti contornatura -- altrimenti contornatura
else else
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) -- recupero il tipo di lavorazione
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
-- se marcatura
if nCntType == 10 then
return MakeByMark( Proc, nRawId, b3Raw, nPartId)
-- se fresatura
else
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
end
end end
end end
+22 -17
View File
@@ -1,7 +1,8 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/06/07 -- ProcessSplit.lua by Egaltech s.r.l. 2022/08/18
-- Gestione calcolo tagli di testa per Travi -- Gestione calcolo tagli di testa per Travi
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio di tipo diceCut. -- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio di tipo diceCut.
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita. -- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessHeadCut = {} local ProcessHeadCut = {}
@@ -173,9 +174,22 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
end end
end end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- recupero la eventuale lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'HeadSide_H2', false, true)
-- recupero i dati della eventuale seconda lama
local dSawDiam2 = 0
local dMaxDepth2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- caratteristiche taglio -- caratteristiche taglio
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM) local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( b3Raw:getDimZ() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
@@ -249,23 +263,12 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
end end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna -- altrimenti necessari tagli da sopra e sotto con testa opportuna
else else
-- recupero la lavorazione con lama da sotto -- verifico esistenza della lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'HeadSide_H2', false, true)
if not sCutting2 then if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library' local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- recupero i dati della seconda lama
local dSawDiam2 = 400
local dMaxDepth2 = 50
if EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- verifico che le due lame riescano a lavorare la sezione -- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ() local dDimZ = b3Raw:getDimZ()
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
@@ -278,16 +281,18 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0 local dAccStart = 0
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- eseguo i tagli da sotto necessari -- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL local dCutOffset = ( i - 1) * dOffsL
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, nil, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
if not bOk then return false, sErr end if not bOk then return false, sErr end
end end
-- eseguo i tagli da sopra necessari -- eseguo i tagli da sopra necessari
for i = nCuts, 1, -1 do for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL local dCutOffset = ( i - 1) * dOffsL
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
if not bOk then return false, sErr end if not bOk then return false, sErr end
end end
end end
+130 -326
View File
@@ -49,6 +49,8 @@
-- 2022/06/29 Migliorate lavorazioni con fresatura di lato per L30 se parametro Q03=2. Ora con 4 facce / 3 facce a L può entrare una fresa grande fino al doppio dell'altezza della tasca / doppio della dimensione minima. -- 2022/06/29 Migliorate lavorazioni con fresatura di lato per L30 se parametro Q03=2. Ora con 4 facce / 3 facce a L può entrare una fresa grande fino al doppio dell'altezza della tasca / doppio della dimensione minima.
-- 2022/07/05 Modifiche per sega a catena di testa e relativa MaxElev. -- 2022/07/05 Modifiche per sega a catena di testa e relativa MaxElev.
-- 2022/07/12 In MakeByChainOrSaw aggiunto check per feature L20 usata in modo improprio e, nel caso, si passa a una lavorazione tasca. -- 2022/07/12 In MakeByChainOrSaw aggiunto check per feature L20 usata in modo improprio e, nel caso, si passa a una lavorazione tasca.
-- 2022/08/11 Aggiunta lavorazione tunnel splittata con sega a catena per tutte le macchine ad esclusione della Fast.
-- 2022/09/01 Spostate le funzioni GetTunnelDimension, CalcCollisionSafety, SetOpenSide in BeamLib.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessLapJoint = {} local ProcessLapJoint = {}
@@ -443,62 +445,6 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
return bUseBHSideMill, bHead, bHeadDir, sMilling, dToolThick, dToolDiam return bUseBHSideMill, bHead, bHeadDir, sMilling, dToolThick, dToolDiam
end end
---------------------------------------------------------------------
local function GetTunnelDimension( Proc, nPartId)
-- sono necessarie almeno due facce
if Proc.Fct < 2 then return 0, 0, 0 end
-- recupero l'ingombro della trave
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- recupero centro e normale delle facce
local ptC = {}
local vtN = {}
for i = 1, Proc.Fct do
ptC[i], vtN[i] = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
end
-- calcolo l'orientamento del tunnel
local vtOrtho
local bAdj = EgtSurfTmFacetsContact( Proc.Id, 0, 1)
if bAdj then
vtOrtho = vtN[1] ^ vtN[2]
else
if Proc.Fct >= 3 then
vtOrtho = vtN[1] ^ vtN[3]
else
return 0, 0, 0
end
end
-- ottengo il boundingBox e prendo le dimensioni lungo la direzione (Z locale) che rappresenta la profondità della fessura
local frFc = Frame3d( ptC[1], vtOrtho) ;
local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc)
local dDepth = b3BoxLoc:getDimZ()
-- recupero gruppo per geometria addizionale
local nAddGrpId = BL.GetAddGroup( nPartId)
if not nAddGrpId then
EgtOutLog( 'Error : missing AddGroup')
return 0, 0, 0
end
-- centro del bounding box locale
local ptCen = b3BoxLoc:getCenter()
ptCen:toGlob( frFc)
-- creo superficie intermedia
local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, ptCen, vtOrtho, b3Solid, GDB_ID.ROOT)
if not nSurfInt then return 0, 0, 0 end
-- ritaglio la superficie con le facce della fessura
for i = 1, Proc.Fct do
EgtCutSurfTmPlane( nSurfInt, ptC[i], -vtN[i], false, GDB_ID.ROOT)
end
local frSurfInt, dDimMax, dDimMin = EgtSurfTmFacetMinAreaRectangle( nSurfInt, 0, GDB_ID.ROOT)
-- cerco la faccia con larghezza pari a dimensione massima della fessura
local nLongIdFace = 0
for i = 1, Proc.Fct do
if abs( vtN[i] * frSurfInt:getVersX()) < 0.5 then
nLongIdFace = i - 1
break
end
end
return dDimMin, dDimMax, dDepth, vtOrtho, nLongIdFace, nSurfInt
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function GetFaceAdj( Proc, nFacInd, dH, dV) local function GetFaceAdj( Proc, nFacInd, dH, dV)
@@ -533,23 +479,6 @@ local function GetFaceAdj( Proc, nFacInd, dH, dV)
return nFacAdj return nFacAdj
end end
---------------------------------------------------------------------
local function CalcCollisionSafety( vtDir)
local dCollSic = 10 * BD.COLL_SIC
if abs( vtDir:getX()) > 0.999 or abs( vtDir:getY()) > 0.999 or abs( vtDir:getZ()) > 0.999 then
dCollSic = 0
elseif abs( vtDir:getX()) > 0.996 or abs( vtDir:getY()) > 0.996 or abs( vtDir:getZ()) > 0.996 then
dCollSic = 1 * BD.COLL_SIC
elseif abs( vtDir:getX()) > 0.89 or abs( vtDir:getY()) > 0.89 or abs( vtDir:getZ()) > 0.89 then
dCollSic = 2.5 * BD.COLL_SIC
elseif abs( vtDir:getX()) > 0.86 or abs( vtDir:getY()) > 0.86 or abs( vtDir:getZ()) > 0.86 then
dCollSic = 4 * BD.COLL_SIC
elseif abs( vtDir:getX()) > 0.707 or abs( vtDir:getY()) > 0.707 or abs( vtDir:getZ()) > 0.707 then
dCollSic = 5.5 * BD.COLL_SIC
end
return dCollSic
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid) local function UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
-- verifico siano una o due facce -- verifico siano una o due facce
@@ -696,8 +625,8 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
local bDown = ( vtN[1]:getZ() < BD.NZ_MINB and vtN[2]:getZ() < BD.NZ_MINB) or local bDown = ( vtN[1]:getZ() < BD.NZ_MINB and vtN[2]:getZ() < BD.NZ_MINB) or
( vtN[1]:getZ() < BD.NZ_MINA and vtN[2]:getZ() < 0.5 and ( vtN[2]:getZ() < -0.1 or not bSmall)) or ( vtN[1]:getZ() < BD.NZ_MINA and vtN[2]:getZ() < 0.5 and ( vtN[2]:getZ() < -0.1 or not bSmall)) or
( vtN[2]:getZ() < BD.NZ_MINA and vtN[1]:getZ() < 0.5 and ( vtN[1]:getZ() < -0.1 or not bSmall)) ( vtN[2]:getZ() < BD.NZ_MINA and vtN[1]:getZ() < 0.5 and ( vtN[1]:getZ() < -0.1 or not bSmall))
-- per L30, se forzata la lavorazione con fresa di lato da parametro Q03=2 oppure Q03=3 non devo ruotare -- se forzata la lavorazione con fresa di lato da parametro Q03=2/3 non devo ruotare
local bForceSideMill = ( Proc.Prc == 30 and ( EgtGetInfo( Proc.Id, 'Q03', 'd') == 2 or EgtGetInfo( Proc.Id, 'Q03', 'd') == 3)) local bForceSideMill = ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'd') == 2 or EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'd') == 3)
bDown = ( bDown and not BD.DOWN_HEAD and not BD.TURN and not bForceSideMill) bDown = ( bDown and not BD.DOWN_HEAD and not BD.TURN and not bForceSideMill)
return true, bDown return true, bDown
-- se più di 2 facce -- se più di 2 facce
@@ -757,7 +686,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
-- se facce formano un tunnel e sono ortogonali -- se facce formano un tunnel e sono ortogonali
if bClosedOrthoFaces then if bClosedOrthoFaces then
-- ottengo le dimensioni del tunnel -- ottengo le dimensioni del tunnel
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId) local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
EgtErase( nSurfInt) EgtErase( nSurfInt)
-- verifico se può essere fatto con svuotatura -- verifico se può essere fatto con svuotatura
if VerifyPocket( Proc, dDimMin) then if VerifyPocket( Proc, dDimMin) then
@@ -797,8 +726,8 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
-- se verso il basso, verifico se utilizzabile seconda faccia -- se verso il basso, verifico se utilizzabile seconda faccia
if bDown then if bDown then
local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc)) local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
-- per lapjoint proc 30, se forzata la lavorazione con fresa di lato da parametro Q03=2 oppure Q03=3 non devo ruotare -- se forzata la lavorazione con fresa di lato da parametro Q03=2/3 non devo ruotare
local bForceSideMill = ( Proc.Prc == 30 and ( EgtGetInfo( Proc.Id, 'Q03', 'd') == 2 or EgtGetInfo( Proc.Id, 'Q03', 'd') == 3) and ( Proc.Fct == 3 or Proc.Fct == 4)) local bForceSideMill = ( ( EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'd') == 2 or EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'd') == 3) and ( Proc.Fct == 3 or Proc.Fct == 4))
if bForceSideMill then if bForceSideMill then
bDown = false bDown = false
elseif nFacInd2 and dElev2 < 2 * dElev then elseif nFacInd2 and dElev2 < 2 * dElev then
@@ -1322,165 +1251,6 @@ local function CheckToInvert( AuxId, bPositive)
return false return false
end end
---------------------------------------------------------------------
local function SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId, nStartPoint)
-- fondo tra loro le curve compatibili
EgtMergeCurvesInCurveCompo( nPathInt)
local nStartIdEnt, nNumEnt = EgtCurveDomain( nPathInt)
local pLastPIni, pLastPEnd
-- faccio una copia della curva e la esplodo
if nStartIdEnt then
-- prendo i punti
for i = 1, nNumEnt do
local pPini = EgtUP( nPathInt, (i-1), GDB_RT.GLOB)
local pPend = EgtUP( nPathInt, EgtIf( i == nNumEnt, 0, i), GDB_RT.GLOB)
-- Se normale lungo la Z considero il box in X e Y
if abs(vtOrtho:getZ()) > 0.999 then
-- se corrisponde a X
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
-- altrimenti se corrisponde a Y
elseif ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
-- altrimenti se normale lungo la Y considero il box in X e Z
elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getY()) > 0.999 then
-- se corrisponde a X
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
-- altrimenti se corrisponde a Z
elseif ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
-- caso che non dovrebbe mai capitare ma gestito per completezza
-- altrimenti se normale lungo la X considero il box in Y e Z
elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getX()) > 0.999 then
-- se corrisponde a Y
if ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
-- altrimenti se corrisponde a Z
elseif ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
-- se asse Z orizzontale verifico se si avvicina piú a Y
elseif abs(vtOrtho:getZ()) < 0.001 then
if abs(vtOrtho:getY()) > 0.75 then
-- se corrisponde a Z
if ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
end
-- se asse Y a 0 (fresa ne davanti ne dietro) verifico se si avvicina piú a Z+
elseif abs(vtOrtho:getY()) < 0.001 then
if abs(vtOrtho:getZ()) > 0.75 then
-- se corrisponde a Y
if ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
-- setto l'entità open
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
if #sActInfo > 0 then
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
else
EgtSetInfo( nPathInt, 'OPEN', (i-1))
end
-- prendo i punti per eventuale modifica del punto di inizio percorso
pLastPIni = pPini
pLastPEnd = pPend
end
end
end
end
-- se devo cambiare il punto di partenza
if nStartPoint then
if pLastPIni and pLastPEnd then
-- calcolo il punto medio con gli ultimi punti utilizzati
local ptPs = ( pLastPIni + pLastPEnd) / 2
EgtChangeClosedCurveStartPoint( nPathInt, ptPs, GDB_RT.GLOB)
-- se devo eliminare la parte open
if nStartPoint == 2 then
EgtRemoveCurveCompoCurve( nPathInt, true)
EgtRemoveCurveCompoCurve( nPathInt, false)
return true
end
end
end
end
return false
end
--------------------------------------------------------------------- ---------------------------------------------------------------------
local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw,
nFacInd, nAddGrpId, dDiam, bMillDown, bDoubleSide) nFacInd, nAddGrpId, dDiam, bMillDown, bDoubleSide)
@@ -1727,7 +1497,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
return false, sErr return false, sErr
end end
-- distanza di sicurezza per evitare collisioni -- distanza di sicurezza per evitare collisioni
dCollSic = CalcCollisionSafety( vtN1) dCollSic = BL.CalcCollisionSafety( vtN1)
-- elevazione massima della faccia -- elevazione massima della faccia
dMaxElev = BL.GetFaceElevation( Proc.Id, nFacInd, nPartId) dMaxElev = BL.GetFaceElevation( Proc.Id, nFacInd, nPartId)
-- ciclo tutta la tabella -- ciclo tutta la tabella
@@ -1772,7 +1542,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
nFirstId = EgtCopyGlob( nPathInt, nAddGrpId) nFirstId = EgtCopyGlob( nPathInt, nAddGrpId)
nNumId = 1 nNumId = 1
-- distanza di sicurezza per evitare collisioni -- distanza di sicurezza per evitare collisioni
dCollSic = CalcCollisionSafety( vtOrtho) dCollSic = BL.CalcCollisionSafety( vtOrtho)
-- calcolo elevazione dalla faccia trasversale aggiunta -- calcolo elevazione dalla faccia trasversale aggiunta
local dSurfIntElev = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0) local dSurfIntElev = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
if bDoubleSide then if bDoubleSide then
@@ -1797,7 +1567,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
-- normale alla faccia aggiunta -- normale alla faccia aggiunta
vtN1 = Vector3d( vtOrtho) vtN1 = Vector3d( vtOrtho)
-- imposto i lati aperti -- imposto i lati aperti
SetOpenSide( nFirstId, vtOrtho, b3Solid, nAddGrpId, 2) BL.SetOpenSide( nFirstId, vtOrtho, b3Solid, nAddGrpId, 2)
end end
-- se non trovato il percorso, esco -- se non trovato il percorso, esco
@@ -2549,7 +2319,7 @@ local function MakeChamfer( Proc, bIs3Faces, nAddGrpId, vtOrtho, b3Solid, nSurfI
if bIs3Faces then if bIs3Faces then
-- nAuxId1, _ = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId) -- nAuxId1, _ = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId)
-- EgtModifyCurveExtrusion( nAuxId1, vtOrtho, GDB_RT.GLOB) -- EgtModifyCurveExtrusion( nAuxId1, vtOrtho, GDB_RT.GLOB)
-- SetOpenSide( nAuxId1, vtOrtho, b3Solid, nAddGrpId, 1) -- BL.SetOpenSide( nAuxId1, vtOrtho, b3Solid, nAddGrpId, 1)
-- nNumIdAux = 2 -- nNumIdAux = 2
-- estraggo i percorsi -- estraggo i percorsi
@@ -2665,7 +2435,7 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
end end
if bOrthoFaces then if bOrthoFaces then
-- ottengo le dimensioni del tunnel -- ottengo le dimensioni del tunnel
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId) local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
end end
-- Recupero le facce adiacenti alla principale -- Recupero le facce adiacenti alla principale
local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1] local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1]
@@ -2826,7 +2596,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
if bOrthoFaces then if bOrthoFaces then
-- ottengo le dimensioni del tunnel -- ottengo le dimensioni del tunnel
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId) dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
-- verifico la direzione -- verifico la direzione
-- se devo inserire il chamfer -- se devo inserire il chamfer
if nChamfer > 0 then if nChamfer > 0 then
@@ -3520,7 +3290,7 @@ local function GetUShapeWidth( Proc, nFacInd)
-- Recupero le facce adiacenti alla principale -- Recupero le facce adiacenti alla principale
local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1] local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1]
-- se non ho facce adiacenti esco subito -- se non ho facce adiacenti esco subito
if not vAdj or #vAdj == 0 then return nil end if not vAdj or #vAdj == 0 then return 0 end
-- Normale della faccia -- Normale della faccia
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
-- Cerco le facce adiacenti alla principale con angolo concavo >= 90 -- Cerco le facce adiacenti alla principale con angolo concavo >= 90
@@ -3574,14 +3344,25 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
-- se è un tunnel verifico se è possibile usare la svuotatura -- se è un tunnel verifico se è possibile usare la svuotatura
if bOrthoFaces then if bOrthoFaces then
-- ottengo le dimensioni del tunnel -- ottengo le dimensioni del tunnel
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId) dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
local nPathInt -- se due facce posso utilizzare utensile con diametro doppio della dimensione minima
if Proc.Fct == 2 then
dDimMin = 2 * dDimMin
-- se tre facce aumento il diametro di quanto possibile
elseif Proc.Fct == 3 then
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, nPartId, false)
local dWidth = GetUShapeWidth( Proc, nFacInd or -1)
if dWidth > dDimMin then
dDimMin = min( 2 * dDimMin, dWidth)
end
end
-- se devo inserire il chamfer -- se devo inserire il chamfer
if nChamfer > 0 then if nChamfer > 0 then
local nOk, sErr = MakeChamfer( Proc, bIs3Faces, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham) local nOk, sErr = MakeChamfer( Proc, bIs3Faces, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham)
if nOk < 0 then return -1, sErr end if nOk < 0 then return -1, sErr end
end end
-- se smusso non è esclusivo -- se smusso non è esclusivo
local nPathInt
if nChamfer < 2 then if nChamfer < 2 then
-- ricalcolo se è lavorabile da sotto -- ricalcolo se è lavorabile da sotto
bMillDown = ( BD.DOWN_HEAD == true) bMillDown = ( BD.DOWN_HEAD == true)
@@ -3604,7 +3385,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
EgtModifyCurveExtrusion( nPathInt, vtOrtho, GDB_RT.GLOB) EgtModifyCurveExtrusion( nPathInt, vtOrtho, GDB_RT.GLOB)
-- se ho 3 facce oppure se forzato, ciclo sulle entià del percorso per segnare quelle che sono aperte. -- se ho 3 facce oppure se forzato, ciclo sulle entià del percorso per segnare quelle che sono aperte.
if bIs3Faces or bSetOpenBorders then if bIs3Faces or bSetOpenBorders then
SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId) BL.SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId)
end end
-- variabili per parametri lavorazione -- variabili per parametri lavorazione
local dMachDepth local dMachDepth
@@ -3613,7 +3394,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
local bOneShot local bOneShot
local bComplete = true local bComplete = true
-- imposto altezza aggiuntiva di elevazione -- imposto altezza aggiuntiva di elevazione
local dCollSic = CalcCollisionSafety( vtOrtho) local dCollSic = BL.CalcCollisionSafety( vtOrtho)
-- se possibile svuotare completamente da una sola parte -- se possibile svuotare completamente da una sola parte
if dMaxDepth > ( dDepth + BD.CUT_EXTRA + dCollSic) then if dMaxDepth > ( dDepth + BD.CUT_EXTRA + dCollSic) then
dMachDepth = ( dDepth / 2) + BD.CUT_EXTRA dMachDepth = ( dDepth / 2) + BD.CUT_EXTRA
@@ -3812,7 +3593,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
end end
if bPock3rd then if bPock3rd then
-- recupero la distanza di sicurezza aggiuntiva -- recupero la distanza di sicurezza aggiuntiva
local dFacCollSic = CalcCollisionSafety( vtN) local dFacCollSic = BL.CalcCollisionSafety( vtN)
-- scelgo se lavorare da sotto -- scelgo se lavorare da sotto
local bFacPocketDn = ( bMakePocketDn and vtN:getZ() < -0.174) local bFacPocketDn = ( bMakePocketDn and vtN:getZ() < -0.174)
-- inserisco la lavorazione di svuotatura -- inserisco la lavorazione di svuotatura
@@ -4206,7 +3987,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
end end
-- prendo il primo versore -- prendo il primo versore
_, vtN1 = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) _, vtN1 = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
dCollSic = CalcCollisionSafety( vtN1) or 0 dCollSic = BL.CalcCollisionSafety( vtN1) or 0
-- se direzione tende verso una delle alle 3 direzioni azzero l'altezza extra -- se direzione tende verso una delle alle 3 direzioni azzero l'altezza extra
if abs( vtN1:getX()) > 0.7 or abs( vtN1:getY()) > 0.7 or abs( vtN1:getZ()) > 0.7 then dCollSic = 0 end if abs( vtN1:getX()) > 0.7 or abs( vtN1:getY()) > 0.7 or abs( vtN1:getZ()) > 0.7 then dCollSic = 0 end
@@ -4263,7 +4044,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
-- alrimenti ho la faccia aggiunta -- alrimenti ho la faccia aggiunta
else else
dCollSic = CalcCollisionSafety( vtOrtho) dCollSic = BL.CalcCollisionSafety( vtOrtho)
nFirstId = EgtCopyGlob( nPathInt, nAddGrpId) nFirstId = EgtCopyGlob( nPathInt, nAddGrpId)
nNumId = 1 nNumId = 1
-- calcolo elevazione dalla faccia trasversale aggiunta -- calcolo elevazione dalla faccia trasversale aggiunta
@@ -4287,7 +4068,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
end end
end end
vtN1 = Vector3d(vtOrtho) vtN1 = Vector3d(vtOrtho)
local bOkPath = SetOpenSide( nFirstId, vtOrtho, b3Solid, nAddGrpId, 2) local bOkPath = BL.SetOpenSide( nFirstId, vtOrtho, b3Solid, nAddGrpId, 2)
-- se non ho un percorso chiuso estraggo i percorsi -- se non ho un percorso chiuso estraggo i percorsi
if bOkPath then if bOkPath then
-- creo percorsi antisplint dagli estremi dei percorsi di contorno trovati -- creo percorsi antisplint dagli estremi dei percorsi di contorno trovati
@@ -4339,20 +4120,56 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Trova l'Ind (0 based) della faccia meglio orientata come l'asse vtAx. Restituisce anche vtN e ptC della faccia stessa. local function MakeTunnelByChainSaw( Proc, sSawing, nLundIdFace, vtOrtho, dWorkDepth, dMaxMat, nStep, dStep, sFaceUse, bOpposite)
local function FindFaceBestOrientedAsAxis( Proc, vtAx) for i = 1, nStep do
local nFaceIndMax = 0 -- inserisco la lavorazione di sawing
local dMaxComp = 0 ; local sName = ''
for i = 1, Proc.Fct do if bOpposite then
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT) sName = 'Csaw_Opp_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i)
local dComp = abs( vtN * vtAx) else
if dComp > dMaxComp then sName = 'Csaw_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i)
nFaceIndMax = i -1 end
dMaxComp = dComp local nMchFId = EgtAddMachining( sName, sSawing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nLundIdFace}})
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- imposto offset radiale
local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
EgtSetMachiningParam( MCH_MP.FACEUSE, sFaceUse)
EgtSetMachiningParam( MCH_MP.DEPTH, dWorkDepth)
-- modifico la distanza di attacco per considerare anche tunnel inclinati
EgtSetMachiningParam( MCH_MP.STARTPOS, 50)
-- eseguo
if not ML.ApplyMachining( true, false) then
if EgtGetOutstrokeInfo() then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
if EgtIsMachiningEmpty() then
_, sWarn = EgtGetMachMgrWarning( 0)
EgtSetOperationMode( nMchFId, false)
return false, sWarn
end end
end end
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFaceIndMax, GDB_ID.ROOT) return true
return nFaceIndMax, ptC, vtN
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -4460,69 +4277,56 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- verifico se posso farlo con la sega-catena -- verifico se posso farlo con la sega-catena
local bMakeChainSaw, sSawing, dMaxMat, dSawCornerRad, dSawThick = VerifyChainSaw( Proc, dDimMin, dDimMax) local bMakeChainSaw, sSawing, dMaxMat, dSawCornerRad, dSawThick = VerifyChainSaw( Proc, dDimMin, dDimMax)
if bMakeChainSaw then if bMakeChainSaw then
-- Ricalcolo l'affondamento tenendo conto di eventuale inclinazione
local dSlDepth
local frSlDh = Frame3d( Proc.Box:getCenter(), vtOrtho)
for i = 1, Proc.Fct do
local b3Fac = EgtSurfTmGetFacetBBoxRef( Proc.Id, i - 1, GDB_BB.STANDARD, frSlDh)
if b3Fac and ( not dSlDepth or b3Fac:getDimZ() < dSlDepth) then
dSlDepth = b3Fac:getDimZ()
end
end
if dSlDepth then dDepth = dSlDepth end
-- Verifico se necessarie più passate -- Verifico se necessarie più passate
local nStep = ceil( ( dDimMin - 100 * GEO.EPS_SMALL) / dSawThick) local nStep = ceil( ( dDimMin - 100 * GEO.EPS_SMALL) / dSawThick)
local dStep = 0 local dStep = 0
if nStep > 1 then if nStep > 1 then
dStep = ( dDimMin - dSawThick) / ( nStep - 1) dStep = ( dDimMin - dSawThick) / ( nStep - 1)
end end
for i = 1, nStep do local bSplit = false
-- inserisco la lavorazione di sawing local sFaceUse, sFaceUseOtherSide
local sName = 'Csaw_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i) -- imposto il lato di lavorazione, da sopra oppure di fronte
local nMchFId = EgtAddMachining( sName, sSawing) -- se è di fronte, non è una Fast e il tagliente non arriva splitto la lavorazione
if not nMchFId then -- Questa feature non è applicata su facce di testa e quindi non controllo l'entrata in X
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing if abs(vtOrtho:getZ()) >= 0.707 then
EgtOutLog( sErr) sFaceUse = MCH_MILL_FU.PARAL_DOWN
return false, sErr else
end sFaceUse = MCH_MILL_FU.PARAL_BACK
-- aggiungo geometria -- per escludere la Fast controllo C_SIMM
EgtSetMachiningGeometry( {{ Proc.Id, nLundIdFace}}) if BD.C_SIMM and dMaxMat < dDepth then
-- imposto uso del lato faccia bSplit = true
-- al momento, dato che la fessura è passante da parte a parte, gestisco solo la lavorazione sFaceUseOtherSide = MCH_MILL_FU.PARAL_FRONT
-- dall'alto e di fronte (da dietro è disabilitata perchè ho exracorsa con la FAST). dDepth = dDepth / 2 + BD.CUT_EXTRA
-- Questa feature non è applicata su facce di testa e quindi non controllo l'entrata in X
if abs(vtOrtho:getZ()) >= 0.707 then
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
else
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_BACK)
end
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- imposto offset radiale
local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- se possibile aumento l'affondamento pari al raggio corner + 1
if dMaxMat > (dDepth + dSawCornerRad + 1) then
EgtSetMachiningParam( MCH_MP.DEPTH, (dDepth + dSawCornerRad + 1))
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
elseif dMaxMat < dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- eseguo
if not ML.ApplyMachining( true, false) then
if EgtGetOutstrokeInfo() then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
if EgtIsMachiningEmpty() then
_, sWarn = EgtGetMachMgrWarning( 0)
EgtSetOperationMode( nMchFId, false)
return false, sWarn
end end
end end
local dWorkDepth = dDepth
-- cerco di estendere il taglio considerando la parte arrotondata della lama + 1
if dMaxMat > dDepth + dSawCornerRad + 1 then
dWorkDepth = dDepth + dSawCornerRad + 1
-- se massimo affondamento utensile inferiore alla profondità da lavorare, setto la profondità di lavoro e emetto warning
elseif dMaxMat < dDepth then
dWorkDepth = dMaxMat
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- lavoro da un lato
local bOk, sErr = MakeTunnelByChainSaw( Proc, sSawing, nLundIdFace, vtOrtho, dWorkDepth, dMaxMat, nStep, dStep, sFaceUse, false)
if not bOk then return false, sErr end
-- se è da lavorare anche dall'altro lato
if bSplit then
bOk, sErr = MakeTunnelByChainSaw( Proc, sSawing, nLundIdFace, vtOrtho, dWorkDepth, dMaxMat, nStep, dStep, sFaceUseOtherSide, true)
if not bOk then return false, sErr end
end
end end
end end
-- altrimenti non è una fessura -- altrimenti non è una fessura
@@ -4833,7 +4637,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
if not bOk then return false, sErr end if not bOk then return false, sErr end
end end
-- imposto altezza aggiuntiva di elevazione -- imposto altezza aggiuntiva di elevazione
local dCollSic = CalcCollisionSafety( vtN) local dCollSic = BL.CalcCollisionSafety( vtN)
-- abilitazione lavorazione da sotto -- abilitazione lavorazione da sotto
local bMillUp = ( BD.DOWN_HEAD and vtN:getZ() > -0.259) local bMillUp = ( BD.DOWN_HEAD and vtN:getZ() > -0.259)
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.342) local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.342)
@@ -5100,7 +4904,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- se devo inserire il chamfer -- se devo inserire il chamfer
if ( ( Proc.Fct == 3 and bIsU) or (Proc.Fct == 2 and bIsL)) and nChamfer > 0 then if ( ( Proc.Fct == 3 and bIsU) or (Proc.Fct == 2 and bIsL)) and nChamfer > 0 then
-- ottengo le dimensioni dello pseudotunnel -- ottengo le dimensioni dello pseudotunnel
local _, _, _, vtOrtho, _, nSurfInt = GetTunnelDimension( Proc, nPartId) local _, _, _, vtOrtho, _, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham) local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham)
if nOk < 0 then return false, sErr end if nOk < 0 then return false, sErr end
end end
@@ -5137,19 +4941,19 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
local bOrthoFacesMaster = nil local bOrthoFacesMaster = nil
local bSetOpenBorders = nil local bSetOpenBorders = nil
-- trovo la faccia con normale più inclinata verso Y -- trovo la faccia con normale più inclinata verso Y
local nFacApproxY, ptCFacApproxY, vtNFacApproxY = FindFaceBestOrientedAsAxis( Proc, Y_AX()) local nFacApproxY, ptCFacApproxY, vtNFacApproxY = BL.FindFaceBestOrientedAsAxis( Proc, Y_AX())
-- se Q03 = 2 e -- se Q03 = 2 e
-- 3 facce a L, oppure -- 3 facce a L, oppure
-- 3 facce non a L ma con una faccia favorevole a Y, oppure -- 3 facce non a L ma con una faccia favorevole a Y, oppure
-- 4 facce -- 4 facce
-- lancio la MakePocket ( lavorazione solo da un lato, fondo della tasca la faccia più favorevole a Y) -- lancio la MakePocket ( lavorazione solo da un lato, fondo della tasca la faccia più favorevole a Y)
if bForceSideMill and (( Proc.Fct == 3 and bIsL) or ( Proc.Fct == 3 and abs( vtNFacApproxY:getY()) >= 0.707 ) or Proc.Fct == 4) then if bForceSideMill and (( Proc.Fct == 3 and bIsL) or ( ( Proc.Fct == 3 or Proc.Fct == 2) and abs( vtNFacApproxY:getY()) >= 0.707 ) or Proc.Fct == 4) then
nFacInd, vtN, ptC = nFacApproxY, vtNFacApproxY, ptCFacApproxY nFacInd, vtN, ptC = nFacApproxY, vtNFacApproxY, ptCFacApproxY
local tvtNx = {} local tvtNx = {}
tvtNx[2] = vtN tvtNx[2] = vtN
local ptPs = ptC local ptPs = ptC
dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd) dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd)
dCollSic = CalcCollisionSafety( tvtNx[2]) dCollSic = BL.CalcCollisionSafety( tvtNx[2])
local dMachDepth = dFacElev + dCollSic local dMachDepth = dFacElev + dCollSic
local frFacRec, dFacDim1, dFacDim2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) local frFacRec, dFacDim1, dFacDim2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
-- limito il diametro utensile massimo a 100 per queste lavorazioni -- limito il diametro utensile massimo a 100 per queste lavorazioni
@@ -5336,7 +5140,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- se devo inserire il chamfer -- se devo inserire il chamfer
if ( ( Proc.Fct == 3 and bIsU) or (Proc.Fct == 2 and bIsL)) and nChamfer > 0 then if ( ( Proc.Fct == 3 and bIsU) or (Proc.Fct == 2 and bIsL)) and nChamfer > 0 then
-- ottengo le dimensioni dello pseudotunnel -- ottengo le dimensioni dello pseudotunnel
local _, _, _, vtOrtho, _, nSurfInt = GetTunnelDimension( Proc, nPartId) local _, _, _, vtOrtho, _, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham) local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham)
if nOk < 0 then return false, sErr end if nOk < 0 then return false, sErr end
end end
@@ -5763,7 +5567,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
local nChamfer, dDepthCham, sErrCham = EvaluateQParam( Proc) local nChamfer, dDepthCham, sErrCham = EvaluateQParam( Proc)
-- se smusso da fare -- se smusso da fare
if nChamfer > 0 then if nChamfer > 0 then
local _, _, _, vtOrtho, _, nSurfInt = GetTunnelDimension( Proc, nPartId) local _, _, _, vtOrtho, _, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham) local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham)
if nOk < 0 then return false, sErr end if nOk < 0 then return false, sErr end
end end
+1 -1
View File
@@ -877,7 +877,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
-- recupero la lavorazione -- recupero la lavorazione
local sMilling local sMilling
local bDownHead = ( nSide == -1 and BD.DOWN_HEAD) local bDownHead = ( nSide == -1 and BD.DOWN_HEAD)
sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bDownHead, bDownHead) sMilling = ML.FindMilling( 'Long2Cut', dElev, nil, nil, nil, not bDownHead, bDownHead)
if not sMilling then if not sMilling then
local sErr = 'Error : Long2Cut not found in library' local sErr = 'Error : Long2Cut not found in library'
+178 -9
View File
@@ -2,6 +2,8 @@
-- Gestione calcolo mortase per Travi -- Gestione calcolo mortase per Travi
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST. -- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda). -- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
-- 2022/07/26 Aggiunta gestione del parametro P04=1 per la pulizia degli angoli con mortasatrice (sega a catena) specifica
-- 2022/07/29 Nella pulitura angoli aggiunto il check dimensioni tasca vs utensile. Corretta direzione utensile per mortasa frontale.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessMortise = {} local ProcessMortise = {}
@@ -79,6 +81,155 @@ function ProcessMortise.GetCutPlane( Proc)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Aggiunge la lavorazione di pulizia angoli
local function AddCleanCornersMachining( nProcId, sMortising, nWorkFaceInd, vtN, dDepth)
-- aggiungo la lavorazione
local sName = 'Mort_' .. ( EgtGetName( nProcId) or tostring( nProcId)) .. '_CleanCorners1'
local nMchFId = EgtAddMachining( sName, sMortising)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMortising
EgtOutLog( sErr)
return false, sErr
end
-- imposto geometria
EgtSetMachiningGeometry( {{ nProcId, nWorkFaceInd}})
-- imposto lato di lavoro e inversione
local vtFaceN = EgtSurfTmFacetNormVersor( nProcId, nWorkFaceInd, GDB_ID.ROOT)
local bInvert = ( vtFaceN:getZ() < -GEO.EPS_SMALL or vtFaceN:getY() > GEO.EPS_SMALL)
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bInvert, MCH_MORTISE_WS.LEFT, MCH_MORTISE_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, bInvert)
-- se richiesto, imposto affondamento
if dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end
-- imposto uso del lato faccia
local nFaceUse = BL.GetNearestParalOpposite( vtN)
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- applico il parametro plunge, che setta la lavorazione per affondare solamente, senza lavorare tutto il contorno; 1: solo lato iniziale, 2: solo lato finale, 3: entrambi
sNotes = 'Plunge=3;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
-- imposto angolo 3° asse rot
local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- calcolo la lavorazione
if not ML.ApplyMachining( true, false) then
if EgtGetOutstrokeInfo() then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
if EgtIsMachiningEmpty() then
_, sWarn = EgtGetMachMgrWarning( 0)
EgtSetOperationMode( nMchFId, false)
return false, sWarn
end
return true, sWarn
end
---------------------------------------------------------------------
-- Pulizia angoli nel caso sia settato il parametro P04=1
local function CleanCorners( Proc, dMorH, vtN, bDoubleDir, AuxId)
-- verifico se è attiva la pulizia e se l'orientamento della feature è adeguato
local bCleanCorners = ( EgtGetInfo( Proc.Id, 'P04', 'i') == 1 and
( AreSameOrOppositeVectorApprox( vtN, X_AX()) or
AreSameOrOppositeVectorApprox( vtN, Y_AX()) or
AreSameOrOppositeVectorApprox( vtN, Z_AX())))
if not bCleanCorners then
EgtOutLog( 'Warning: mortising not aligned with XYZ axes, corner cleaning skipped')
return
end
-- cerco la lavorazione adatta
local sMortisingCleanCorners = ML.FindSawing( 'Mortising')
if not sMortisingCleanCorners then
EgtOutLog( 'Warning: mortising tool not found, corner cleaning skipped')
return
end
-- recupero i dati dell'utensile
local dSawWidth = 50
local dSawThick = 12
local dMaxDepth = 200
if EgtMdbSetCurrMachining( sMortisingCleanCorners) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dSawWidth = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawWidth
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- se l'utensile non arriva in fondo, riduco l'affondamento
local sWarn
local dDepth
local bUseDoubleDir
if bDoubleDir then
if ( 2 * dMorH + dSawWidth / 2) > dMaxDepth + 10 * GEO.EPS_SMALL then
bUseDoubleDir = true
if ( dMorH + dSawWidth / 2) > dMaxDepth + 10 * GEO.EPS_SMALL then
dDepth = dMaxDepth
sWarn = 'Warning in corner cleaning with mortise: elevation (' .. EgtNumToString( dMorH + dSawWidth / 2, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
else
dDepth = dMorH + dSawWidth / 2
end
else
dDepth = 2 * dMorH + dSawWidth / 2
end
else
if dMorH > dMaxDepth + 10 * GEO.EPS_SMALL then
dDepth = dMaxDepth
sWarn = 'Warning in corner cleaning with mortise: elevation (' .. EgtNumToString( dMorH, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
EgtOutLog( sWarn)
end
end
-- verifico se la tasca ha dimensioni sufficienti per l'utensile
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
local frMor, dMortiseWidth, dMortiseThick = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
if abs( frMor:getVersX() * X_AX()) < abs( frMor:getVersY() * X_AX()) then
dMortiseWidth, dMortiseThick = dMortiseThick, dMortiseWidth
end
EgtErase( nFlat)
if dSawWidth >= dMortiseWidth + 10 * GEO.EPS_SMALL or dSawThick >= dMortiseThick + 10 * GEO.EPS_SMALL then
sWarn = 'warning in corner cleaning with mortise: pocket too small'
EgtOutLog( sWarn)
return true, sWarn
end
-- cerco le due facce migliori da lavorare
local nWorkFaceInd, nWorkFaceInd2
if AreSameOrOppositeVectorApprox( vtN, X_AX()) then
nWorkFaceInd, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ Y_AX())
nWorkFaceInd2, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ Y_AX(), nWorkFaceInd)
else
nWorkFaceInd, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ X_AX())
nWorkFaceInd2, _, _ = BL.FindFaceBestOrientedAsAxis( Proc, vtN ^ X_AX(), nWorkFaceInd)
end
-- lavoro la prima faccia
local bOk1, sErr = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd, vtN, dDepth)
-- lavoro la seconda faccia
local bOk2, sErr2 = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd2, vtN, dDepth)
if sErr2 then sErr = ( sErr or '') .. EgtIf( sErr, '\n', '') .. sErr2 end
-- se richiesto di lavorare dall'altra parte
if bUseDoubleDir then
local bOk3, sErr3 = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd, -vtN, dDepth)
if sErr3 then sErr = ( sErr or '') .. EgtIf( sErr, '\n', '') .. sErr3 end
local bOk4, sErr4 = AddCleanCornersMachining( Proc.Id, sMortisingCleanCorners, nWorkFaceInd2, -vtN, dDepth)
if sErr4 then sErr = ( sErr or '') .. EgtIf( sErr, '\n', '') .. sErr4 end
end
if not bOk1 or not bOk2 or not bOk3 or not bOk4 then
return false, sErr
end
return true, sWarn
end
---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- ingombro del pezzo -- ingombro del pezzo
@@ -157,7 +308,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local dMove = bxMin:getZ()-bxMax:getZ() local dMove = bxMin:getZ()-bxMax:getZ()
-- se il percorso ausiliario è esterno al grezzo, lo riavvicino -- se il percorso ausiliario è esterno al grezzo, lo riavvicino
if abs( dMove) > GEO.EPS_SMALL then if abs( dMove) > GEO.EPS_SMALL then
AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup(nPartId)) AuxId = EgtCopyGlob( AuxId, BL.GetAddGroup( nPartId))
EgtMove( AuxId, Vector3d(0,0,-dMove)) EgtMove( AuxId, Vector3d(0,0,-dMove))
EgtMove( nFlat, Vector3d(0,0,-dMove)) EgtMove( nFlat, Vector3d(0,0,-dMove))
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT) frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
@@ -172,8 +323,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3) EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- Se mortasa chiusa -- Se mortasa chiusa
if not bOpenBtm then if not bOpenBtm then
-- verifico che la mortasa non sia orientata verso il basso (limite -5 deg) o che ci sia una testa da sotto o un rinvio angolare -- verifico che la mortasa non sia orientata verso il basso (limite -5 deg) o che ci sia una testa da sotto o un rinvio angolare o macchina Turn
if vtN:getZ() < -0.1 and not BD.DOWN_HEAD and not BD.ANG_TRASM then if vtN:getZ() < -0.1 and not BD.DOWN_HEAD and not BD.ANG_TRASM and not BD.TURN then
local sErr = 'Error : Mortise from bottom impossible' local sErr = 'Error : Mortise from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
@@ -286,8 +437,12 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if bPockAngTrasm then if bPockAngTrasm then
nSCC = MCH_SCC.ADIR_NEAR nSCC = MCH_SCC.ADIR_NEAR
elseif not BD.C_SIMM then elseif not BD.C_SIMM then
if vtN:getY() < GEO.EPS_SMALL then if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN:getX()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_XP
elseif vtN:getY() < GEO.EPS_SMALL then
nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
else else
nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP) nSCC = EgtIf( bRevertSide, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
@@ -346,11 +501,19 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- sistemo la direzione di lavoro -- sistemo la direzione di lavoro
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
if vtN:getY() < GEO.EPS_SMALL then local nSCC = MCH_SCC.NONE
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) if not BD.C_SIMM then
else if abs( vtN:getX()) < GEO.EPS_SMALL and abs( vtN:getY()) < GEO.EPS_SMALL then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM) nSCC = MCH_SCC.ADIR_YM
elseif abs( vtN:getX()) < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_XP
elseif vtN:getY() < GEO.EPS_SMALL then
nSCC = MCH_SCC.ADIR_YP
else
nSCC = MCH_SCC.ADIR_YM
end
end end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- se altezza mortasa differente da altezza massima lavorabile -- se altezza mortasa differente da altezza massima lavorabile
if abs( dMorH - dMaxDepth) > GEO.EPS_SMALL then if abs( dMorH - dMaxDepth) > GEO.EPS_SMALL then
nDepthMin = -dMorH nDepthMin = -dMorH
@@ -368,6 +531,12 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
return false, sErr return false, sErr
end end
end end
-- verifico se necessaria la pulizia degli angoli ( tenone ad angoli non raggiati) e applico nel caso
local _, sWarn2 = CleanCorners( Proc, dMorH, vtN, bOpenBtm and not bForceOneSide, AuxId)
if sWarn2 then
if not sWarn then sWarn = '' end
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
end
return true, sWarn return true, sWarn
end end
+12 -6
View File
@@ -440,7 +440,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sMillingDown local sMillingDown
if bDouble then if bDouble then
if nSide == 0 then if nSide == 0 then
if BD.DOWN_HEAD then if BD.DOWN_HEAD then
-- recupero la lavorazione -- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true) sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then if not sMillingDown then
@@ -448,7 +448,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( sWarn) EgtOutLog( sWarn)
bDouble = false bDouble = false
end end
else elseif not BD.TURN then
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')' sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn) EgtOutLog( sWarn)
bDouble = false bDouble = false
@@ -489,7 +489,9 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- imposto l'affondamento -- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
@@ -588,7 +590,9 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end end
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
@@ -633,7 +637,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then ( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchVId = EgtAddMachining( sName, sMilling) local nMchVId = EgtAddMachining( sName, sMilling)
if not nMchVId then if not nMchVId then
@@ -659,6 +663,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -669,7 +674,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then ( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchV2Id = EgtAddMachining( sName, sMilling) local nMchV2Id = EgtAddMachining( sName, sMilling)
if not nMchV2Id then if not nMchV2Id then
@@ -692,6 +697,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
+14 -7
View File
@@ -440,7 +440,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
local sMillingDown local sMillingDown
if bDouble then if bDouble then
if nSide == 0 then if nSide == 0 then
if BD.DOWN_HEAD then if BD.DOWN_HEAD then
-- recupero la lavorazione -- recupero la lavorazione
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true) sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
if not sMillingDown then if not sMillingDown then
@@ -448,7 +448,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtOutLog( sWarn) EgtOutLog( sWarn)
bDouble = false bDouble = false
end end
else elseif not BD.TURN then
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')' sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
EgtOutLog( sWarn) EgtOutLog( sWarn)
bDouble = false bDouble = false
@@ -489,7 +489,9 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- imposto l'affondamento -- imposto l'affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
@@ -588,7 +590,9 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
end end
-- posizione braccio porta testa -- posizione braccio porta testa
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale -- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
local bFinish local bFinish
local dOriOffset = 0 local dOriOffset = 0
@@ -633,7 +637,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then ( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchVId = EgtAddMachining( sName, sMilling) local nMchVId = EgtAddMachining( sName, sMilling)
if not nMchVId then if not nMchVId then
@@ -659,6 +663,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH') EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -669,7 +674,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto -- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela) -- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then ( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchV2Id = EgtAddMachining( sName, sMilling) local nMchV2Id = EgtAddMachining( sName, sMilling)
if not nMchV2Id then if not nMchV2Id then
@@ -692,6 +697,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
EgtSetMachiningParam( MCH_MP.STEP, 0) EgtSetMachiningParam( MCH_MP.STEP, 0)
EgtSetMachiningParam( MCH_MP.OFFSR, 0) EgtSetMachiningParam( MCH_MP.OFFSR, 0)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1)) EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
-- eseguo -- eseguo
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
@@ -701,12 +707,13 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
end end
end end
-- aggiorno ingombro testa o coda per presa -- aggiorno ingombro testa o coda per presa
if nSide ~= 1 then if nSide ~= 1 then -- se feature di fianco o da sotto
if bHead then if bHead then
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMin():getX()) BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMin():getX())
else else
BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX()) BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX())
end end
-- altrimenti feature da sopra
else else
if bHead then if bHead then
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMax():getX()) BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMax():getX())
+3
View File
@@ -184,6 +184,9 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
for i = 1, nC do for i = 1, nC do
-- Posizione braccio portatesta -- Posizione braccio portatesta
local nSCC = EgtIf( ( BD.C_SIMM or i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM) local nSCC = EgtIf( ( BD.C_SIMM or i == 1 or i == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
if abs( vtDir:getY()) > 0.5 then
nSCC = EgtIf( vtDir:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
end
-- ciclo sulle passate -- ciclo sulle passate
local dOffset = dWidth - dDepth ; local dOffset = dWidth - dDepth ;
local dLioTang = 0 local dLioTang = 0
+2 -2
View File
@@ -500,20 +500,20 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
if abs( vtRef:getZ()) > 0.1 then if abs( vtRef:getZ()) > 0.1 then
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD) local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
dHCI = 0.75 * dHCI
else else
dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
end end
dHCI = 0.75 * dHCI
BL.UpdateHCING( nRawId, dHCI) BL.UpdateHCING( nRawId, dHCI)
elseif Proc.Tail then elseif Proc.Tail then
local dTCI = 0 local dTCI = 0
if abs( vtRef:getZ()) > 0.1 then if abs( vtRef:getZ()) > 0.1 then
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD) local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
dTCI = 0.75 * dTCI
else else
dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX() dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
end end
dTCI = 0.75 * dTCI
BL.UpdateTCING( nRawId, dTCI) BL.UpdateTCING( nRawId, dTCI)
end end
+5 -4
View File
@@ -1,6 +1,7 @@
-- ProcessSimpleScarf.lua by Egaltech s.r.l. 2020/06/04 -- ProcessSimpleScarf.lua by Egaltech s.r.l. 2020/06/04
-- Gestione calcolo giunto Gerber per Travi -- Gestione calcolo giunto Gerber per Travi
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe) -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
-- 2022/08/09 Ora se la feature ha meno di due facce viene richiamata la normale Cut.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessSimpleScarf = {} local ProcessSimpleScarf = {}
@@ -10,6 +11,7 @@ require( 'EgtBase')
local BL = require( 'BeamLib') local BL = require( 'BeamLib')
local Fbs = require( 'FacesBySaw') local Fbs = require( 'FacesBySaw')
local DC = require( 'DiceCut') local DC = require( 'DiceCut')
local Cut = require( 'ProcessCut')
EgtOutLog( ' ProcessSimpleScarf started', 1) EgtOutLog( ' ProcessSimpleScarf started', 1)
@@ -138,12 +140,11 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmT
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- verifico che ci siano almeno due facce (altrimenti non è da lavorare) -- se ci sono meno di due facce si riduce a una normale Cut
local nFacetCnt = EgtSurfTmFacetCount( Proc.Id) local nFacetCnt = EgtSurfTmFacetCount( Proc.Id)
if nFacetCnt < 2 then if nFacetCnt < 2 then
local sErr = 'Error : number of faces not enough' local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, nil, nil, nil, dOvmTail)
EgtOutLog( sErr) return bOk, sErr
return false, sErr
end end
-- dati delle facce -- dati delle facce
local ptC = {} local ptC = {}
+89 -56
View File
@@ -1,7 +1,8 @@
-- ProcessSplit.lua by Egaltech s.r.l. 2022/06/07 -- ProcessSplit.lua by Egaltech s.r.l. 2022/08/18
-- Gestione calcolo tagli di separazione per Travi -- Gestione calcolo tagli di separazione per Travi
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio con sega a catena seguito da rifinitura con lama (aggiunta funzione MakeSplitByChainSaw); gestione eventuale creazione nuova fase dall'interno della Make. -- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio con sega a catena seguito da rifinitura con lama (aggiunta funzione MakeSplitByChainSaw); gestione eventuale creazione nuova fase dall'interno della Make.
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita. -- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local ProcessSplit = {} local ProcessSplit = {}
@@ -148,7 +149,7 @@ end
-- lavorazione con sega a catena per sezioni alte e larghe -- lavorazione con sega a catena per sezioni alte e larghe
local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs) local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
-- Recupero i dati dell'utensile -- Recupero i dati dell'utensile
local sSawing = ML.FindSawing('Sawing') local sSawing = ML.FindSawing( 'Sawing')
local dMaxMat = 0 local dMaxMat = 0
local dSawCornerRad = 0 local dSawCornerRad = 0
local dSawThick = 0 local dSawThick = 0
@@ -182,10 +183,10 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
-- imposto uso del lato faccia -- imposto uso del lato faccia
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot -- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2)) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT) local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT)
vtOrthO = BL.GetVersRef( nFaceUse) local vtOrtho = BL.GetVersRef( nFaceUse)
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2)) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
-- imposto offset radiale per mantenere il materiale in coda per la finitura -- imposto offset radiale per mantenere il materiale in coda per la finitura
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- imposto allungamento percorso iniziale e finale a zero -- imposto allungamento percorso iniziale e finale a zero
@@ -212,8 +213,8 @@ local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
return false, sErr return false, sErr
end end
-- impostazione alternativa angolo 3° asse rot -- impostazione alternativa angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1)) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1)) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
if not ML.ApplyMachining( true, false) then if not ML.ApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false) EgtSetOperationMode( nMchFId, false)
@@ -232,9 +233,9 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail) function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail)
if not BD.OVM_CHAIN_HBEAM then -- impostazione default a variabili aggiunte
BD.OVM_CHAIN_HBEAM = 8 if not BD.OVM_CHAIN_HBEAM then BD.OVM_CHAIN_HBEAM = 8 end
end if not BD.C_SIMM_ENC then BD.C_SIMM_ENC = 180 end
-- ingombro del grezzo -- ingombro del grezzo
local b3Raw = EgtGetRawPartBBox( nRawId) local b3Raw = EgtGetRawPartBBox( nRawId)
-- inserimento smussi -- inserimento smussi
@@ -261,9 +262,22 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
end end
end end
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
-- recupero la eventuale lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
-- recupero i dati della eventuale seconda lama
local dSawDiam2 = 0
local dMaxDepth2 = 0
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- caratteristiche taglio -- caratteristiche taglio
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM) local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( b3Raw:getDimZ() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)) local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA))
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
@@ -293,43 +307,70 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
if bBigSectionCut then if bBigSectionCut then
local bFinishingNeeded = false local bFinishingNeeded = false
if bSplit then if bSplit then
--taglio sega a catena -- recupero lunghezza massima di lavoro della sega a catena
local cutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN local sSawing = ML.FindSawing( 'Sawing')
local sNotesSplit = 'Presplit;' local dMaxMat = 0
local dTlen = 0
if EgtMdbSetCurrMachining( sSawing or '') then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dTLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dTLen
end
end
-- assegno offset in lunghezza
local dOffs = 0 local dOffs = 0
if dOvmTail > BD.OVM_CHAIN_HBEAM then if dOvmTail > BD.OVM_CHAIN_HBEAM then
dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM
bFinishingNeeded = true bFinishingNeeded = true
end end
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, cutDepth, sNotesSplit, dOffs) -- se pezzo non troppo alto, taglio singolo da sopra
if not bOk then return bOk, sErr, nNewPhase end if b3Raw:getDimZ() < dMaxMat - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL then
sNotesSplit = 'Split;' local cutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs) sNotesSplit = 'Split;'
if not bOk then return bOk, sErr, nNewPhase end bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_TOP, cutDepth, sNotesSplit, dOffs)
-- creo nuova fase per successiva finitura if not bOk then return bOk, sErr, nNewPhase end
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET) -- se pezzo non troppo largo, taglio singolo da davanti
nNewPhase = EgtGetCurrPhase() elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dMaxMat, dTLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then
nDispId = EgtGetPhaseDisposition( nNewPhase) local cutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN
if sDownOrSideOrStd == 'down' then sNotesSplit = 'Split;'
EgtRotateRawPart( nRawId, X_AX(), 180) bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs)
EgtSetInfo( nDispId, 'TYPE', 'MID2') if not bOk then return bOk, sErr, nNewPhase end
EgtSetInfo( nDispId, 'ROT', -2) -- altrimenti tagli dai due fianchi (dietro e davanti)
elseif sDownOrSideOrStd == 'side' then
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
if not bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtSetInfo( nDispId, 'TYPE', 'MID2')
EgtSetInfo( nDispId, 'ROT', -1)
else else
EgtSetInfo( nDispId, 'TYPE', 'END') local cutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
local sNotesSplit = 'Presplit;'
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
sNotesSplit = 'Split;'
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs)
if not bOk then return bOk, sErr, nNewPhase end
end
-- se necessaria finitura, creo nuova fase
if bFinishingNeeded then
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
nNewPhase = EgtGetCurrPhase()
nDispId = EgtGetPhaseDisposition( nNewPhase)
if sDownOrSideOrStd == 'down' then
EgtRotateRawPart( nRawId, X_AX(), 180)
EgtSetInfo( nDispId, 'TYPE', 'MID2')
EgtSetInfo( nDispId, 'ROT', -2)
elseif sDownOrSideOrStd == 'side' then
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
if not bPreMove then EgtMoveRawPart( nRawId, vtMove) end
EgtSetInfo( nDispId, 'TYPE', 'MID2')
EgtSetInfo( nDispId, 'ROT', -1)
else
EgtSetInfo( nDispId, 'TYPE', 'END')
end
EgtSetInfo( nDispId, 'ORD', nOrd)
-- se grezzo successivo senza pezzi e finale, va tolto
local nNextRawId = EgtGetNextRawPart( nRawId)
if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BD.MinRaw then
EgtRemoveRawPartFromCurrPhase( nNextRawId)
end
end end
EgtSetInfo( nDispId, 'ORD', nOrd)
-- se grezzo successivo senza pezzi e finale, va tolto
local nNextRawId = EgtGetNextRawPart( nRawId)
if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BD.MinRaw then
EgtRemoveRawPartFromCurrPhase( nNextRawId)
end
-- fine creazione nuova fase
end end
-- se è necessaria la finitura -- se è necessaria la finitura
if bFinishingNeeded or not bSplit then if bFinishingNeeded or not bSplit then
@@ -405,23 +446,12 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
end end
-- altrimenti necessari tagli da sopra e sotto con testa opportuna -- altrimenti necessari tagli da sopra e sotto con testa opportuna
else else
-- recupero la lavorazione con lama da sotto -- verifico esistenza della lavorazione con lama da sotto
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
if not sCutting2 then if not sCutting2 then
local sErr = 'Error : cutting H2 not found in library' local sErr = 'Error : cutting H2 not found in library'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
end end
-- recupero i dati della seconda lama
local dSawDiam2 = 400
local dMaxDepth2 = 50
if EgtMdbSetCurrMachining( sCutting2) then
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
end
end
-- verifico che le due lame riescano a lavorare la sezione -- verifico che le due lame riescano a lavorare la sezione
local dDimZ = b3Raw:getDimZ() local dDimZ = b3Raw:getDimZ()
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
@@ -434,11 +464,14 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
local dAccStart = 0 local dAccStart = 0
-- limiti da sotto
local dVzLimDwnUp
if BD.TURN then dVzLimDwnUp = -2 end
-- eseguo i tagli da sotto necessari -- eseguo i tagli da sotto necessari
for i = nCuts, 1, -1 do for i = nCuts, 1, -1 do
local dCutOffset = ( i - 1) * dOffsL local dCutOffset = ( i - 1) * dOffsL
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;') local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, nil, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
if not bOk then return false, sErr end if not bOk then return false, sErr end
end end
-- eseguo i tagli da sopra necessari -- eseguo i tagli da sopra necessari
@@ -450,7 +483,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
else else
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
end end
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw) local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
if not bOk then return false, sErr end if not bOk then return false, sErr end
end end
end end
+1 -1
View File
@@ -46,7 +46,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
return false, sErr return false, sErr
end end
-- verifico che il testo non sia orientato verso il basso (-5 deg) -- verifico che il testo non sia orientato verso il basso (-5 deg)
if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD then if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Text from bottom impossible' local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Text from bottom impossible'
EgtOutLog( sErr) EgtOutLog( sErr)
return false, sErr return false, sErr
+11 -11
View File
@@ -1,5 +1,5 @@
-- BeamNestProcess.lua by Egaltech s.r.l. 2021/06/14 -- BeamNestProcess.lua by Egaltech s.r.l. 2021/06/14
-- Gestione nesting automatico pareti -- Gestione nesting automatico travi
-- Intestazioni -- Intestazioni
require( 'EgtBase') require( 'EgtBase')
@@ -257,7 +257,7 @@ while TotRawCount( Raws) > 0 and PartsToFill( Parts) > 0 do
local Results = {} local Results = {}
for RawIndex = 1, #Raws do for RawIndex = 1, #Raws do
if Raws[RawIndex].Count > 0 then if Raws[RawIndex].Count > 0 then
Results[RawIndex] = ExecMaximumFilling( Raws[RawIndex], PartsToNest) Results[RawIndex] = ExecMaximumFilling( Raws[RawIndex], PartsToNest)
else else
Results[RawIndex] = { FillRatio = 0.001, LenToFill = 1000} Results[RawIndex] = { FillRatio = 0.001, LenToFill = 1000}
end end
@@ -267,10 +267,10 @@ while TotRawCount( Raws) > 0 and PartsToFill( Parts) > 0 do
local dMinWaste = 100000 local dMinWaste = 100000
for ResultIndex = 1, #Results do for ResultIndex = 1, #Results do
if Results[ResultIndex] then if Results[ResultIndex] then
local dWaste = (1 - Results[ResultIndex].FillRatio) * Raws[ResultIndex].LenToFill local dWaste = (1 - Results[ResultIndex].FillRatio) * Raws[ResultIndex].LenToFill
if dWaste < dMinWaste then if dWaste < dMinWaste then
dMinWaste = dWaste dMinWaste = dWaste
nMinWasteRawIndex = ResultIndex nMinWasteRawIndex = ResultIndex
end end
end end
end end
@@ -301,11 +301,11 @@ while TotRawCount( Raws) > 0 and PartsToFill( Parts) > 0 do
end end
end end
nRawTot = nRawTot + 1 nRawTot = nRawTot + 1
-- Aggiorno per prossima iterazione -- Aggiorno per prossima iterazione
Raws[nMinWasteRawIndex].Count = Raws[nMinWasteRawIndex].Count - 1 Raws[nMinWasteRawIndex].Count = Raws[nMinWasteRawIndex].Count - 1
for i = 1, Results[nMinWasteRawIndex].DiffParts do for i = 1, Results[nMinWasteRawIndex].DiffParts do
local PartId = Results[nMinWasteRawIndex].Data[i].Id local PartId = Results[nMinWasteRawIndex].Data[i].Id
PartsToNest[PartId].Cnt = PartsToNest[PartId].Cnt - Results[nMinWasteRawIndex].Data[i].Count PartsToNest[PartId].Cnt = PartsToNest[PartId].Cnt - Results[nMinWasteRawIndex].Data[i].Count
end end
end end
nCycle = nCycle + 1 nCycle = nCycle + 1