Merge branch 'master' into develop
This commit is contained in:
+1
-1
@@ -71,7 +71,7 @@ variables:
|
||||
.CodeReplicaR: &CodeReplicaR
|
||||
- |
|
||||
net use R: /delete
|
||||
net use R: $env:NET_SHARE_R /u:$env:NET_USER $RDRIVE_PASSWD
|
||||
net use R: $env:NET_SHARE_R /u:$env:NET_USERQ $ZDRIVE_PASSWD
|
||||
ROBOCOPY . R:\EgtData\$env:APP_NAME /MIR /XF .git* /XD .git
|
||||
SLEEP 2
|
||||
net use R: /delete
|
||||
|
||||
@@ -7,6 +7,7 @@ REM Compilazione 32 bit
|
||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
|
||||
@@ -45,6 +46,7 @@ REM Compilazione 32 bit
|
||||
\EgtProg\Dll32\luac53 -o 32\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\BatchProcess.lua BatchProcess.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\BatchProcessNew.lua BatchProcessNew.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\GetBeamData.lua GetBeamData.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\NestProcess.lua NestProcess.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\Process.lua Process.lua
|
||||
\EgtProg\Dll32\luac53 -o 32\Rotate.lua Rotate.lua
|
||||
@@ -55,6 +57,7 @@ REM Compilazione 64 bit
|
||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamExec.lua LuaLibs\BeamExec.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\BeamLib.lua LuaLibs\BeamLib.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\DiceCut.lua LuaLibs\DiceCut.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\FaceByPocket.lua LuaLibs\FaceByPocket.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\FacesBySaw.lua LuaLibs\FacesBySaw.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\MachiningLib.lua LuaLibs\MachiningLib.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessBlockHausFront.lua LuaLibs\ProcessBlockHausFront.lua
|
||||
@@ -93,6 +96,7 @@ REM Compilazione 64 bit
|
||||
\EgtProg\Dll64\luac53 -o 64\LuaLibs\ProcessTyroleanDovetail.lua LuaLibs\ProcessTyroleanDovetail.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\BatchProcess.lua BatchProcess.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\BatchProcessNew.lua BatchProcessNew.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\GetBeamData.lua GetBeamData.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\NestProcess.lua NestProcess.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\Process.lua Process.lua
|
||||
\EgtProg\Dll64\luac53 -o 64\Rotate.lua Rotate.lua
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
-- GetWallData.lua by Egaltech s.r.l. 2021/11/22
|
||||
-- Recupero dati da file WallData.lua di macchina
|
||||
|
||||
-- Intestazioni
|
||||
require( 'EgtBase')
|
||||
_ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( false)
|
||||
|
||||
-- Per test
|
||||
--GWD = {}
|
||||
--GWD.MACHINE = 'Essetre-90480019_MW'
|
||||
|
||||
local sLog = 'GetBeamData : ' .. GWD.MACHINE
|
||||
EgtOutLog( sLog)
|
||||
|
||||
-- Imposto direttorio libreria specializzata per Travi
|
||||
EgtAddToPackagePath( GWD.BASEDIR .. '\\LuaLibs\\?.lua')
|
||||
|
||||
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
|
||||
local sMachDir = EgtGetCurrMachineDir()
|
||||
if not EgtExistsFile( sMachDir .. '\\Beam\\BeamData.lua') then
|
||||
GWD.ERR = 12
|
||||
GWD.MSG = 'Error not configured for beam machine : ' .. GWD.MACHINE
|
||||
WriteErrToLogFile( GWD.ERR, GWD.MSG)
|
||||
PostErrView( GWD.ERR, GWD.MSG)
|
||||
return
|
||||
end
|
||||
|
||||
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
|
||||
EgtRemoveBaseMachineDirFromPackagePath()
|
||||
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua')
|
||||
|
||||
-- Carico i dati globali
|
||||
local BD = require( 'BeamData')
|
||||
|
||||
-- Assegno valori di interesse
|
||||
GWD.SIMUL_VIEW_DIR = BD.SIMUL_VIEW_DIR
|
||||
GWD.OVM_MID = BD.OVM_MID
|
||||
|
||||
-- Tutto ok
|
||||
GWD.ERR = 0
|
||||
|
||||
EgtOutLog( ' +++ GetWallData completed')
|
||||
+309
-208
@@ -26,6 +26,9 @@
|
||||
-- 2021/12/15 Corretta CompareFeature (risultato deve essere simmetrico scambiando le feature).
|
||||
-- 2021/12/20 Ulteriore correzione a CompareFeature (caso con entrambe senza geometria).
|
||||
-- 2022/05/04 Nell'ordinamento quando si confrontano i box delle feature aggiunta verifica preliminare della loro validità.
|
||||
-- 2022/05/31 Aggiunta gestione sovramateriale per sezioni alte e larghe e informazione di eventuale creazione nuova fase dalla AddFeatureMachining.
|
||||
-- 2022/06/10 Per sezioni alte e larghe modificata la gestione del sovramateriale per considerare la presenza di feature preesistenti e eventuale parametro Q05, che determinano la presenza o meno della finitura.
|
||||
-- Create le funzioni AnalyzeHeadFeatures e AnalyzeTailFeatures. Spostate più in alto le funzioni CollectFeatures, isHeadFeature e isTailFeature.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local BeamExec = {}
|
||||
@@ -122,6 +125,238 @@ EgtOutLog( ' BeamExec started', 1)
|
||||
EgtMdbSetGeneralParam( MCH_GP.MAXDEPTHSAFE, BD.COLL_SIC)
|
||||
EgtMdbSave()
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
-- feature sempre di testa o coda per il gruppo
|
||||
if Proc.Grp == 1 or Proc.Grp == 2 then
|
||||
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
|
||||
end
|
||||
-- feature sempre di testa o coda nonostante il gruppo
|
||||
if ( Proc.Grp == 3 or Proc.Grp == 4) and
|
||||
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
|
||||
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
|
||||
end
|
||||
-- gestioni speciali
|
||||
if LapJoint.Identify( Proc) then
|
||||
return LapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
end
|
||||
if Drill.Identify( Proc) then
|
||||
return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
end
|
||||
if RoundArch.Identify( Proc) then
|
||||
return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
end
|
||||
if Dovetail.Identify( Proc) then
|
||||
return Dovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
end
|
||||
if FreeContour.Identify( Proc) then
|
||||
return FreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
end
|
||||
-- non è di testa
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
-- lunghezza di riferimento per spostare le feature di coda appena prima
|
||||
local dAdvTailLen = BD.LEN_VERY_SHORT_PART or BD.LEN_SHORT_PART
|
||||
-- feature sempre di testa o coda per il gruppo (se non troppo lunga)
|
||||
if Proc.Grp == 1 or Proc.Grp == 2 then
|
||||
-- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda
|
||||
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
|
||||
-- se taglio, lo avanzo
|
||||
if Proc.Prc == 10 then
|
||||
return false, true
|
||||
end
|
||||
end
|
||||
-- standard
|
||||
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH and Proc.Box:getDimX() < BD.MAX_LEN_HTFEA)
|
||||
end
|
||||
-- feature sempre di testa o coda nonostante il gruppo
|
||||
if ( Proc.Grp == 3 or Proc.Grp == 4) and
|
||||
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
|
||||
-- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda
|
||||
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < dAdvTailLen and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
|
||||
-- se profilo front solo con smusso, lo avanzo
|
||||
if Proc.Prc == 100 and ProfFront.OnlyChamfer( Proc) then
|
||||
return false, true
|
||||
end
|
||||
-- se profilo concavo solo con smusso, lo avanzo
|
||||
if Proc.Prc == 101 and ProfConcave.OnlyChamfer( Proc) then
|
||||
return false, true
|
||||
end
|
||||
-- se profilo convesso solo con smusso, lo avanzo
|
||||
if Proc.Prc == 102 and ProfConvex.OnlyChamfer( Proc) then
|
||||
return false, true
|
||||
end
|
||||
-- se profilo caudato solo con smusso, lo avanzo
|
||||
if Proc.Prc == 103 and ProfCamb.OnlyChamfer( Proc) then
|
||||
return false, true
|
||||
end
|
||||
-- se profilo head solo con smusso, lo avanzo
|
||||
if Proc.Prc == 106 and ProfHead.OnlyChamfer( Proc) then
|
||||
return false, true
|
||||
end
|
||||
end
|
||||
-- standard
|
||||
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
|
||||
end
|
||||
-- gestioni speciali
|
||||
if LapJoint.Identify( Proc) then
|
||||
return LapJoint.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
if Drill.Identify( Proc) then
|
||||
return Drill.IsTailFeature( Proc, b3Raw, dCurrOvmT)
|
||||
end
|
||||
if DtMortise.Identify( Proc) then
|
||||
return DtMortise.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
if RoundArch.Identify( Proc) then
|
||||
return RoundArch.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
if Dovetail.Identify( Proc) then
|
||||
return Dovetail.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
if FreeContour.Identify( Proc) then
|
||||
return FreeContour.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
-- non è di coda
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
-- recupero le feature
|
||||
local vProc = {}
|
||||
local LayerId = {}
|
||||
LayerId[1] = BL.GetAddGroup( PartId)
|
||||
LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings')
|
||||
for nInd = 1, 2 do
|
||||
local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL)
|
||||
while ProcId do
|
||||
local nEntType = EgtGetType( ProcId)
|
||||
if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or
|
||||
nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then
|
||||
local nGrp = EgtGetInfo( ProcId, 'GRP', 'i')
|
||||
local nPrc = EgtGetInfo( ProcId, 'PRC', 'i')
|
||||
local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1
|
||||
local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0
|
||||
local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0
|
||||
if nGrp and nPrc and nDo == 1 then
|
||||
local Proc = {}
|
||||
Proc.Id = ProcId
|
||||
Proc.Grp = nGrp
|
||||
Proc.Prc = nPrc
|
||||
Proc.Flg = 1
|
||||
Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0
|
||||
Proc.Diam = 0
|
||||
Proc.Fcs = 0
|
||||
Proc.Fce = 0
|
||||
Proc.CutId = nCutId
|
||||
Proc.TaskId = nTaskId
|
||||
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
|
||||
if Proc.Box and not Proc.Box:isEmpty() then
|
||||
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
table.insert( vProc, Proc)
|
||||
-- se foro
|
||||
if Drill.Identify( Proc) then
|
||||
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
|
||||
Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw)
|
||||
-- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta
|
||||
if Drill.Split( Proc, b3Raw) then
|
||||
-- aggiorno flags prima parte foro (dati tabelle sempre per riferimento)
|
||||
Proc.Flg = 2
|
||||
Proc.Head = Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
Proc.Tail = Drill.IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
-- definisco dati seconda parte
|
||||
local Proc2 = {}
|
||||
Proc2.Id = ProcId
|
||||
Proc2.Grp = nGrp
|
||||
Proc2.Prc = nPrc
|
||||
Proc2.Flg = -2
|
||||
Proc2.Box = BBox3d( Proc.Box)
|
||||
Proc2.Fct = Proc.Fct
|
||||
Proc2.Diam = Proc.Diam
|
||||
Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH)
|
||||
Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH)
|
||||
Proc2.Fcs = Proc.Fce
|
||||
Proc2.Fce = Proc.Fcs
|
||||
Proc2.CutId = Proc.CutId
|
||||
Proc2.TaskId = Proc.TaskId
|
||||
table.insert( vProc, Proc2)
|
||||
end
|
||||
-- se BlockHaus HalfLap
|
||||
elseif Proc.Prc == 37 then
|
||||
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId)
|
||||
if nFacInd then
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
if vtN then
|
||||
Proc.vtN = Vector3d( vtN)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Proc.Head = false
|
||||
Proc.Tail = false
|
||||
Proc.Flg = 0
|
||||
table.insert( vProc, Proc)
|
||||
EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)')
|
||||
end
|
||||
end
|
||||
end
|
||||
ProcId = EgtGetNext( ProcId)
|
||||
end
|
||||
end
|
||||
return vProc
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
|
||||
local nReplacedFeatureId = nil
|
||||
local bHeadFinishingNeeded = true
|
||||
for i = 1, #vProc do
|
||||
local Proc = vProc[i]
|
||||
-- controllo se esiste già una feature taglio di testa
|
||||
if not nReplacedFeatureId then
|
||||
if ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10 then
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
if ptC and vtN and AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL then
|
||||
nReplacedFeatureId = Proc.Id
|
||||
end
|
||||
end
|
||||
end
|
||||
if Proc.Head and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 340 then
|
||||
-- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria
|
||||
bHeadFinishingNeeded = not ((abs(Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and (abs(Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH))
|
||||
end
|
||||
end
|
||||
return bHeadFinishingNeeded, nReplacedFeatureId
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
|
||||
local nReplacedFeatureId = nil
|
||||
local bTailFinishingNeeded = true
|
||||
for i = 1, #vProc do
|
||||
local Proc = vProc[i]
|
||||
-- controllo se esistè già una feature taglio di coda
|
||||
if not nReplacedFeatureId then
|
||||
if ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10 then
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
if ptC and vtN and AreSameVectorApprox( vtN, -X_AX()) and abs( ptC:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL then
|
||||
nReplacedFeatureId = Proc.Id
|
||||
end
|
||||
end
|
||||
end
|
||||
if Proc.Tail and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 350 then
|
||||
-- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria
|
||||
bTailFinishingNeeded = not ((abs(Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and (abs(Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH))
|
||||
end
|
||||
end
|
||||
return bTailFinishingNeeded, nReplacedFeatureId
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- *** Inserimento delle travi nel grezzo ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -157,7 +392,13 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
|
||||
local Len = dRawL
|
||||
local nPrevRaw, dPrevDelta
|
||||
local DeltaS = dOvmHead
|
||||
local DeltaSMin = 0
|
||||
local DeltaE = BD.OVM_MID
|
||||
-- controllo sezione larga e alta per considerare taglio con sega
|
||||
local bBigSectionCut = false
|
||||
if BD.MAX_DIM_HTCUT and BD.CUT_EXTRA_MIN and ( dRawW > 2 * BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( dRawH > 2 * BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) then
|
||||
bBigSectionCut = true
|
||||
end
|
||||
for i = 1, #vBeam do
|
||||
-- assegno identificativo pezzo
|
||||
local Pz = vBeam[i].Id
|
||||
@@ -165,6 +406,37 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
|
||||
local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT)
|
||||
local b3Solid = vBeam[i].Box
|
||||
if b3Part:isEmpty() or b3Solid:isEmpty() then break end
|
||||
if bBigSectionCut then
|
||||
-- lascio in coda solo il materiale necessario; il resto verrà tolto nell'head cut successivo
|
||||
local lastB3Solid = nil
|
||||
local dOffset = dOvmHead
|
||||
if i > 1 then
|
||||
lastB3Solid = vBeam[i-1].Box
|
||||
dOffset = vBeam[i].PosX - vBeam[i-1].PosX - lastB3Solid:getDimX()
|
||||
end
|
||||
-- analizzo le features per valutare l'esistenza di feature head/tail che renderebbero inutili le rispettive finiture o di tagli di testa/coda sostituiti da cui leggere il parametro Q05
|
||||
local vProc = CollectFeatures( Pz, b3Solid, 0)
|
||||
local bSFinishingNeeded, nReplacedHeadCutFeatureId = AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
|
||||
local iSQ05Value = nil
|
||||
if nReplacedHeadCutFeatureId then
|
||||
iSQ05Value = EgtGetInfo( nReplacedHeadCutFeatureId, 'Q05', 'i')
|
||||
end
|
||||
if ( dOffset <= BD.OVM_CHAIN_HBEAM and iSQ05Value == 0) or not bSFinishingNeeded then
|
||||
DeltaSMin = 0
|
||||
else
|
||||
DeltaSMin = BD.OVM_BLADE_HBEAM
|
||||
end
|
||||
local bEFinishingNeeded, nReplacedTailCutFeatureId = AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
|
||||
local iEQ05Value = nil
|
||||
if nReplacedTailCutFeatureId then
|
||||
iEQ05Value = EgtGetInfo( nReplacedTailCutFeatureId, 'Q05', 'i')
|
||||
end
|
||||
if iEQ05Value == 0 or not bEFinishingNeeded then
|
||||
DeltaE = BD.OVM_CHAIN_HBEAM
|
||||
else
|
||||
DeltaE = BD.OVM_CHAIN_HBEAM + BD.OVM_BLADE_HBEAM
|
||||
end
|
||||
end
|
||||
EgtOutLog( 'PartSez=' .. EgtNumToString( b3Part:getDimY(), 1) .. 'x' .. EgtNumToString( b3Part:getDimZ(), 1), 3)
|
||||
-- se sezione compatibile e lunghezza disponibile sufficiente
|
||||
local PartLen = b3Solid:getDimX()
|
||||
@@ -175,8 +447,8 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
|
||||
( abs( PartHeight - dRawW) < 10 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 10 * GEO.EPS_SMALL)) and
|
||||
NextLen + DeltaE >= 0 then
|
||||
-- eventuale sovramateriale di testa
|
||||
if vBeam[i].PosX then
|
||||
DeltaS = max( vBeam[i].PosX - ( dRawL - Len), 0)
|
||||
if i > 1 and vBeam[i].PosX then
|
||||
DeltaS = max( vBeam[i].PosX - ( dRawL - Len), DeltaSMin)
|
||||
end
|
||||
-- dimensioni del grezzo
|
||||
local CrawLen = min( PartLen + DeltaS + DeltaE, Len)
|
||||
@@ -202,6 +474,9 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup
|
||||
EgtSetInfo( nPrevRaw, 'BDST', DeltaS + dPrevDelta)
|
||||
end
|
||||
end
|
||||
if DeltaE > 0.09 then
|
||||
EgtSetInfo( nRaw, 'TOVM', DeltaE)
|
||||
end
|
||||
-- aggiungo faccia per taglio finale al pezzo
|
||||
BL.AddPartEndFace( Pz, b3Solid)
|
||||
-- inserisco il pezzo nel grezzo
|
||||
@@ -279,103 +554,6 @@ local function Verify90DegRotation( nRawId)
|
||||
( dRawH < BD.MAX_WIDTH2 + 10 * GEO.EPS_SMALL and dRawW < BD.MAX_HEIGHT2 + 10 * GEO.EPS_SMALL)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
-- feature sempre di testa o coda per il gruppo
|
||||
if Proc.Grp == 1 or Proc.Grp == 2 then
|
||||
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
|
||||
end
|
||||
-- feature sempre di testa o coda nonostante il gruppo
|
||||
if ( Proc.Grp == 3 or Proc.Grp == 4) and
|
||||
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
|
||||
return ( Proc.Box:getCenter():getX() > b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
|
||||
end
|
||||
-- gestioni speciali
|
||||
if LapJoint.Identify( Proc) then
|
||||
return LapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
end
|
||||
if Drill.Identify( Proc) then
|
||||
return Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
end
|
||||
if RoundArch.Identify( Proc) then
|
||||
return RoundArch.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
end
|
||||
if Dovetail.Identify( Proc) then
|
||||
return Dovetail.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
end
|
||||
if FreeContour.Identify( Proc) then
|
||||
return FreeContour.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
end
|
||||
-- non è di testa
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function IsTailFeature( Proc, b3Raw, dCurrOvmH)
|
||||
-- feature sempre di testa o coda per il gruppo (se non troppo lunga)
|
||||
if Proc.Grp == 1 or Proc.Grp == 2 then
|
||||
-- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda
|
||||
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < BD.LEN_SHORT_PART and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
|
||||
-- se taglio, lo avanzo
|
||||
if Proc.Prc == 10 then
|
||||
return false, true
|
||||
end
|
||||
end
|
||||
-- standard
|
||||
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH and Proc.Box:getDimX() < BD.MAX_LEN_HTFEA)
|
||||
end
|
||||
-- feature sempre di testa o coda nonostante il gruppo
|
||||
if ( Proc.Grp == 3 or Proc.Grp == 4) and
|
||||
( Proc.Prc == 38 or Proc.Prc == 51 or Proc.Prc == 56 or Proc.Prc == 100 or Proc.Prc == 101 or Proc.Prc == 102 or Proc.Prc == 103 or Proc.Prc == 106) then
|
||||
-- se abilitato avanzamento lavorazione feature di coda e pezzo corto (quindi a caduta) e feature in coda
|
||||
if BD.ADVANCE_TAIL_CUT and b3Raw:getDimX() < BD.LEN_SHORT_PART and Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH then
|
||||
-- se profilo front solo con smusso, lo avanzo
|
||||
if Proc.Prc == 100 and ProfFront.OnlyChamfer( Proc) then
|
||||
return false, true
|
||||
end
|
||||
-- se profilo concavo solo con smusso, lo avanzo
|
||||
if Proc.Prc == 101 and ProfConcave.OnlyChamfer( Proc) then
|
||||
return false, true
|
||||
end
|
||||
-- se profilo convesso solo con smusso, lo avanzo
|
||||
if Proc.Prc == 102 and ProfConvex.OnlyChamfer( Proc) then
|
||||
return false, true
|
||||
end
|
||||
-- se profilo caudato solo con smusso, lo avanzo
|
||||
if Proc.Prc == 103 and ProfCamb.OnlyChamfer( Proc) then
|
||||
return false, true
|
||||
end
|
||||
-- se profilo head solo con smusso, lo avanzo
|
||||
if Proc.Prc == 106 and ProfHead.OnlyChamfer( Proc) then
|
||||
return false, true
|
||||
end
|
||||
end
|
||||
-- standard
|
||||
return ( Proc.Box:getCenter():getX() < b3Raw:getCenter():getX() - 0.5 * dCurrOvmH)
|
||||
end
|
||||
-- gestioni speciali
|
||||
if LapJoint.Identify( Proc) then
|
||||
return LapJoint.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
if Drill.Identify( Proc) then
|
||||
return Drill.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
if DtMortise.Identify( Proc) then
|
||||
return DtMortise.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
if RoundArch.Identify( Proc) then
|
||||
return RoundArch.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
if Dovetail.Identify( Proc) then
|
||||
return Dovetail.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
if FreeContour.Identify( Proc) then
|
||||
return FreeContour.IsTailFeature( Proc, b3Raw)
|
||||
end
|
||||
-- non è di coda
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function PrintFeatures( vProc, b3Raw)
|
||||
EgtOutLog( ' RawBox=' .. tostring( b3Raw))
|
||||
@@ -395,93 +573,6 @@ local function PrintFeatures( vProc, b3Raw)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CollectFeatures( PartId, b3Raw, dCurrOvmH)
|
||||
-- recupero le feature
|
||||
local vProc = {}
|
||||
local LayerId = {}
|
||||
LayerId[1] = BL.GetAddGroup( PartId)
|
||||
LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings')
|
||||
for nInd = 1, 2 do
|
||||
local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL)
|
||||
while ProcId do
|
||||
local nEntType = EgtGetType( ProcId)
|
||||
if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or
|
||||
nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then
|
||||
local nGrp = EgtGetInfo( ProcId, 'GRP', 'i')
|
||||
local nPrc = EgtGetInfo( ProcId, 'PRC', 'i')
|
||||
local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1
|
||||
local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0
|
||||
local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0
|
||||
if nGrp and nPrc and nDo == 1 then
|
||||
local Proc = {}
|
||||
Proc.Id = ProcId
|
||||
Proc.Grp = nGrp
|
||||
Proc.Prc = nPrc
|
||||
Proc.Flg = 1
|
||||
Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0
|
||||
Proc.Diam = 0
|
||||
Proc.Fcs = 0
|
||||
Proc.Fce = 0
|
||||
Proc.CutId = nCutId
|
||||
Proc.TaskId = nTaskId
|
||||
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
|
||||
if Proc.Box and not Proc.Box:isEmpty() then
|
||||
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH)
|
||||
table.insert( vProc, Proc)
|
||||
-- se foro
|
||||
if Drill.Identify( Proc) then
|
||||
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
|
||||
Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw)
|
||||
-- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta
|
||||
if Drill.Split( Proc, b3Raw) then
|
||||
-- aggiorno flags prima parte foro (dati tabelle sempre per riferimento)
|
||||
Proc.Flg = 2
|
||||
Proc.Head = Drill.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
Proc.Tail = Drill.IsTailFeature( Proc, b3Raw, dCurrOvmH)
|
||||
-- definisco dati seconda parte
|
||||
local Proc2 = {}
|
||||
Proc2.Id = ProcId
|
||||
Proc2.Grp = nGrp
|
||||
Proc2.Prc = nPrc
|
||||
Proc2.Flg = -2
|
||||
Proc2.Box = BBox3d( Proc.Box)
|
||||
Proc2.Fct = Proc.Fct
|
||||
Proc2.Diam = Proc.Diam
|
||||
Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH)
|
||||
Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH)
|
||||
Proc2.Fcs = Proc.Fce
|
||||
Proc2.Fce = Proc.Fcs
|
||||
Proc2.CutId = Proc.CutId
|
||||
Proc2.TaskId = Proc.TaskId
|
||||
table.insert( vProc, Proc2)
|
||||
end
|
||||
-- se BlockHaus HalfLap
|
||||
elseif Proc.Prc == 37 then
|
||||
local nFacInd = BL.GetFaceWithMostAdj( Proc.Id, PartId)
|
||||
if nFacInd then
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
if vtN then
|
||||
Proc.vtN = Vector3d( vtN)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Proc.Head = false
|
||||
Proc.Tail = false
|
||||
Proc.Flg = 0
|
||||
table.insert( vProc, Proc)
|
||||
EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)')
|
||||
end
|
||||
end
|
||||
end
|
||||
ProcId = EgtGetNext( ProcId)
|
||||
end
|
||||
end
|
||||
return vProc
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function OrderFeatures( vProc, b3Raw)
|
||||
|
||||
@@ -929,10 +1020,10 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw)
|
||||
local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
|
||||
local bOk = true
|
||||
local sErr = ''
|
||||
local bNewPhase = false
|
||||
local nNewPhase = -1
|
||||
EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1)
|
||||
-- se intestatura ( 1-340-X )
|
||||
if Hcut.Identify( Proc) then
|
||||
@@ -941,13 +1032,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
|
||||
-- se separazione ( 2-350-X )
|
||||
elseif Split.Identify( Proc) then
|
||||
-- esecuzione separazione o eliminazione grezzo residuo
|
||||
bOk, sErr = Split.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- richiedo il passaggio alla seconda fase di lavorazione di questa trave
|
||||
bNewPhase = true
|
||||
bOk, sErr, nNewPhase = Split.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
|
||||
-- se taglio ( 1/2-010-X)
|
||||
elseif Cut.Identify( Proc) then
|
||||
-- esecuzione taglio
|
||||
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, nil, nil, nil, nil, nil, dCurrOvmT)
|
||||
-- se doppio taglio ( 1/2-011-X)
|
||||
elseif DoubleCut.Identify( Proc) then
|
||||
-- esecuzione doppio taglio
|
||||
@@ -968,7 +1057,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
|
||||
-- se taglio con lama ( 0/3/4-013-X)
|
||||
elseif SawCut.Identify( Proc) then
|
||||
-- esecuzione taglio
|
||||
bOk, sErr = SawCut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
bOk, sErr = SawCut.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
|
||||
-- se mezzo-legno di testa ( 1/2-030-X)
|
||||
elseif RidgeLap.Identify( Proc) then
|
||||
-- esecuzione mezzo-legno di testa
|
||||
@@ -990,11 +1079,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
|
||||
-- se giunzione francese ( 1/2-035-X)
|
||||
elseif FrenchRidgeLap.Identify( Proc) then
|
||||
-- esecuzione giunzione francese
|
||||
bOk, sErr = FrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
bOk, sErr = FrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
|
||||
-- se block house front ( 3/4-038-X)
|
||||
elseif BlockHausFront.Identify( Proc) then
|
||||
-- esecuzione giunzione francese
|
||||
bOk, sErr = BlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
bOk, sErr = BlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
|
||||
-- se tenone ( 1/2-050-X)
|
||||
elseif Tenon.Identify( Proc) then
|
||||
-- esecuzione tenone
|
||||
@@ -1022,11 +1111,11 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
|
||||
-- se giunto Gerber ( 1/2-071-X)
|
||||
elseif ScarfJoint.Identify( Proc) then
|
||||
-- esecuzione giunto Gerber
|
||||
bOk, sErr = ScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
bOk, sErr = ScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
|
||||
-- se giunto Gerber ( 1/2-070-X)
|
||||
elseif Scarf.Identify( Proc) then
|
||||
-- esecuzione giunto Gerber
|
||||
bOk, sErr = Scarf.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
bOk, sErr = Scarf.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
|
||||
-- se giunto a gradino ( 1/2-080-X)
|
||||
elseif StepJoint.Identify( Proc) then
|
||||
-- esecuzione giunto a gradino
|
||||
@@ -1061,10 +1150,10 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
|
||||
bOk, sErr = ProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- se incastro tirolo ( 1/2/3/4-136-X)
|
||||
elseif TyroleanDovetail.Identify( Proc) then
|
||||
bOk, sErr = TyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
bOk, sErr = TyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
|
||||
-- se giunto coda di rondine ( 1/2/3/4-138-X)
|
||||
elseif Dovetail.Identify( Proc) then
|
||||
bOk, sErr = Dovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
bOk, sErr = Dovetail.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH, dCurrOvmT)
|
||||
-- se contorno libero ( 0/3/4-250-X)
|
||||
elseif FreeContour.Identify( Proc) then
|
||||
-- esecuzione contorno
|
||||
@@ -1079,7 +1168,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
|
||||
EgtOutLog( sErr)
|
||||
bOk = false
|
||||
end
|
||||
return bOk, sErr, bNewPhase
|
||||
return bOk, sErr, nNewPhase
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -1213,8 +1302,9 @@ function BeamExec.ProcessFeatures()
|
||||
-- ingombro del grezzo e sovramateriale di testa
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', 'd') or 0
|
||||
local dCurrOvmT = EgtGetInfo( nRawId, 'TOVM', 'd') or 0
|
||||
-- recupero le feature di lavorazione della trave
|
||||
local vProc = CollectFeatures( nPartId, b3Raw, dCurrOvmH)
|
||||
local vProc = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
-- le ordino lungo X
|
||||
OrderFeatures( vProc, b3Raw)
|
||||
-- le classifico
|
||||
@@ -1233,8 +1323,11 @@ function BeamExec.ProcessFeatures()
|
||||
SetCutsOnFrontMortises( vProc)
|
||||
-- eventuale spostamento fori sui tenoni
|
||||
MoveDrillsOnTenon( vProc)
|
||||
-- identifico la condizione di lavorazione, in base a bSomeDown e bSomeSide
|
||||
local sDownOrSideOrStd = 'standard'
|
||||
-- se richiesto ribaltamento (oppure rotazione)
|
||||
if ( bSomeDown or bSomeSide) and not BD.DOWN_HEAD and not BD.TURN then
|
||||
sDownOrSideOrStd = 'down'
|
||||
-- ribalto le travi della fase corrente
|
||||
local nRId = nRawId
|
||||
while nRId do
|
||||
@@ -1247,7 +1340,7 @@ function BeamExec.ProcessFeatures()
|
||||
-- creo la lavorazione
|
||||
local Proc = vProc[i]
|
||||
if Proc.Flg ~= 0 and Proc.Down then
|
||||
local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw)
|
||||
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bNeedHCut, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
|
||||
if not bOk then
|
||||
nTotErr = nTotErr + 1
|
||||
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||
@@ -1256,8 +1349,10 @@ function BeamExec.ProcessFeatures()
|
||||
else
|
||||
table.insert( Stats, {Err=0, Msg='', Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||
end
|
||||
-- se era taglio di separazione, aggiungo nuova fase
|
||||
if bNewPhase then
|
||||
-- se è taglio di separazione, verifico se ha già aggiunto una nuova fase oppure se è da creare
|
||||
if nNewPhase > 0 then
|
||||
nPhase = nNewPhase
|
||||
elseif nNewPhase == 0 then
|
||||
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
|
||||
EgtRotateRawPart( nRawId, X_AX(), 180)
|
||||
-- se grezzo successivo senza pezzi e finale, va tolto
|
||||
@@ -1295,6 +1390,7 @@ function BeamExec.ProcessFeatures()
|
||||
end
|
||||
-- se richiesta rotazione
|
||||
if bSomeSide and not BD.DOWN_HEAD and not BD.TURN then
|
||||
sDownOrSideOrStd = 'side'
|
||||
-- vettore movimento grezzi per rotazione di 90deg
|
||||
local dDeltaYZ = EgtGetRawPartBBox( nRawId):getDimY() - EgtGetRawPartBBox( nRawId):getDimZ()
|
||||
local vtMove = Vector3d( 0, dDeltaYZ / 2, dDeltaYZ / 2)
|
||||
@@ -1314,7 +1410,7 @@ function BeamExec.ProcessFeatures()
|
||||
-- creo la lavorazione
|
||||
local Proc = vProc[i]
|
||||
if Proc.Flg ~= 0 and Proc.Side then
|
||||
local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw)
|
||||
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dCurrOvmT)
|
||||
if not bOk then
|
||||
nTotErr = nTotErr + 1
|
||||
table.insert( Stats, {Err=1, Msg=sMsg, Rot=-2, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||
@@ -1325,7 +1421,9 @@ function BeamExec.ProcessFeatures()
|
||||
end
|
||||
if bOk then nSideMchOk = nSideMchOk + 1 end
|
||||
-- se era taglio di separazione, aggiungo nuova fase
|
||||
if bNewPhase then
|
||||
if nNewPhase > 0 then
|
||||
nPhase = nNewPhase
|
||||
elseif nNewPhase == 0 then
|
||||
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
|
||||
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
|
||||
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
|
||||
@@ -1364,12 +1462,13 @@ function BeamExec.ProcessFeatures()
|
||||
EgtSetInfo( nDispId, 'TYPE', EgtIf( not bSplitRot, 'MID', 'END2'))
|
||||
EgtSetInfo( nDispId, 'ORD', nOrd)
|
||||
end
|
||||
sDownOrSideOrStd = 'standard'
|
||||
-- inserisco le lavorazioni non ribaltate della trave
|
||||
for i = 1, #vProc do
|
||||
-- creo la lavorazione
|
||||
local Proc = vProc[i]
|
||||
if Proc.Flg ~= 0 and ( not ( Proc.Down or Proc.Side) or BD.DOWN_HEAD or BD.TURN) then
|
||||
local bOk, sMsg, bNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw)
|
||||
local bOk, sMsg, nNewPhase = AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, false, b3Raw, nOrd, sDownOrSideOrStd, nil, nil, dCurrOvmT)
|
||||
if not bOk then
|
||||
nTotErr = nTotErr + 1
|
||||
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||
@@ -1379,7 +1478,9 @@ function BeamExec.ProcessFeatures()
|
||||
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||
end
|
||||
-- se era taglio di separazione, aggiungo nuova fase
|
||||
if bNewPhase then
|
||||
if nNewPhase > 0 then
|
||||
nPhase = nNewPhase
|
||||
elseif nNewPhase == 0 then
|
||||
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
|
||||
-- se grezzo successivo senza pezzi e finale, va tolto
|
||||
local nNextRawId = EgtGetNextRawPart( nRawId)
|
||||
|
||||
+39
-28
@@ -1,4 +1,4 @@
|
||||
-- BeamLib.lua by Egaltech s.r.l. 2022/05/03
|
||||
-- BeamLib.lua by Egaltech s.r.l. 2022/05/25
|
||||
-- Libreria globale per Travi
|
||||
-- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto.
|
||||
-- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm.
|
||||
@@ -11,6 +11,7 @@
|
||||
-- 2022/01/11 In GetNearest*Opposite ridotto vantaggio XY rispetto a Z da 1 -> 0.9 a 1 -> 0.99.
|
||||
-- 2022/04/05 Modifiche a GetNzLimDownUp per FAST.
|
||||
-- 2022/05/03 Ulteriore limitazione a GetNzLimDownUp per FAST.
|
||||
-- 2022/05/18 Correzioni e migliorie a PutStartNearestToEdge.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local BeamLib = {}
|
||||
@@ -188,40 +189,42 @@ function BeamLib.PutStartOnLonger( nCrvId)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, bDown)
|
||||
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, bDown)
|
||||
-- verifico che la curva sia chiusa
|
||||
if not EgtCurveIsClosed( nCrvId) then return false end
|
||||
-- recupero il versore normale al piano di lavoro o estrusione
|
||||
local vtN = EgtCurveExtrusion( nCrvId, GDB_ID.ROOT)
|
||||
-- coefficienti per riportare la distanza nel piano di lavoro
|
||||
local dCoeffX = 1 / ( sqrt( 1 - vtN:getX() * vtN:getX()))
|
||||
local dCoeffY = 1 / ( sqrt( 1 - vtN:getY() * vtN:getY()))
|
||||
local dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ()))
|
||||
local dCoeffY = 0
|
||||
if abs( vtN:getY()) < 0.999 then dCoeffY= 1 / ( sqrt( 1 - vtN:getY() * vtN:getY())) end
|
||||
local dCoeffZ = 0
|
||||
if abs( vtN:getZ()) < 0.999 then dCoeffZ = 1 / ( sqrt( 1 - vtN:getZ() * vtN:getZ())) end
|
||||
-- cerco l'estremo più vicino al box e lo imposto come inizio (se da sotto escludo Zmax e viceversa)
|
||||
local dUopt = 0
|
||||
local dDopt = GEO.INFINITO
|
||||
local dZopt = GEO.INFINITO
|
||||
local dUi, dUf = EgtCurveDomain( nCrvId)
|
||||
for dU = dUi, dUf, 0.5 do
|
||||
local ptP = EgtUP( nCrvId, dU, GDB_ID.ROOT)
|
||||
if ptP then
|
||||
local vtDp = EgtUV( nCrvId, dU, -1, GDB_ID.ROOT)
|
||||
local vtDs = EgtUV( nCrvId, dU, 1, GDB_ID.ROOT)
|
||||
local bTg = ( vtDp and vtDs and vtDp * vtDs > 0.96)
|
||||
if ptP and bTg then
|
||||
local vtMin = ptP - b3Raw:getMin()
|
||||
local vtMax = ptP - b3Raw:getMax()
|
||||
local dD = abs( vtMin:getX()) * dCoeffX
|
||||
dD = min( abs( vtMax:getX()) * dCoeffX, dD)
|
||||
dD = min( abs( vtMin:getY()) * dCoeffY, dD)
|
||||
local dD = abs( vtMin:getY()) * dCoeffY
|
||||
dD = min( abs( vtMax:getY()) * dCoeffY, dD)
|
||||
if bDown then
|
||||
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
|
||||
else
|
||||
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
|
||||
end
|
||||
if dD < dDopt + GEO.EPS_SMALL then
|
||||
dDopt = dD
|
||||
dD = min( abs( vtMin:getZ()) * dCoeffZ, dD)
|
||||
dD = min( abs( vtMax:getZ()) * dCoeffZ, dD)
|
||||
local dZ = abs( EgtIf( bDown, vtMin:getZ(), vtMax:getZ())) * dCoeffZ
|
||||
if dD < dMaxDist and dZ < dZopt + GEO.EPS_SMALL then
|
||||
dUopt = dU
|
||||
dDopt = dD
|
||||
dZopt = dZ
|
||||
end
|
||||
end
|
||||
end
|
||||
if abs( dUopt - dUi) > GEO.EPS_ZERO then
|
||||
if abs( dUopt - dUi) > GEO.EPS_ZERO and abs( dUopt - dUf) > GEO.EPS_ZERO then
|
||||
EgtChangeClosedCurveStart( nCrvId, dUopt)
|
||||
end
|
||||
return true
|
||||
@@ -266,8 +269,8 @@ function BeamLib.GetNearestParalOpposite( vtRef, vtNorm)
|
||||
vtMyRef:normalize()
|
||||
end
|
||||
-- se prevalente una componente orizzontale (con piccolissimo vantaggio)
|
||||
if abs( vtMyRef:getX()) > 0.99 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.99 * abs( vtMyRef:getZ()) then
|
||||
if abs( vtMyRef:getX()) > abs( vtMyRef:getY()) - GEO.EPS_SMALL then
|
||||
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then
|
||||
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then
|
||||
if vtMyRef:getX() > -GEO.EPS_SMALL then
|
||||
return MCH_MILL_FU.PARAL_LEFT
|
||||
else
|
||||
@@ -300,9 +303,9 @@ function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm)
|
||||
vtMyRef:normalize()
|
||||
end
|
||||
-- se prevalente una componente orizzontale (con piccolissimo vantaggio)
|
||||
if abs( vtMyRef:getX()) > 0.99 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.99 * abs( vtMyRef:getZ()) then
|
||||
-- se prevale la componente destra/sinistra (con piccolo vantaggio)
|
||||
if abs( vtMyRef:getX()) > 0.9 * abs( vtMyRef:getY()) then
|
||||
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then
|
||||
-- se prevale la componente destra/sinistra
|
||||
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getY()) then
|
||||
if vtMyRef:getX() > -GEO.EPS_SMALL then
|
||||
return MCH_MILL_FU.ORTHO_LEFT
|
||||
else
|
||||
@@ -682,10 +685,14 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
||||
if not BD.C_SIMM then
|
||||
if BD.C_SIMM or BD.TURN then
|
||||
return -0.484
|
||||
else
|
||||
if vtOrtho and vtOrtho:getZ() > 0.5 then
|
||||
if vtN and ( abs( vtN:getY()) < 0.1 or abs( vtN:getY()) > 0.49) then
|
||||
if vtN and ( abs( vtN:getY()) < 0.259 or abs( vtN:getY()) > 0.819) then
|
||||
return -0.708
|
||||
elseif vtN and abs( vtN:getY()) > 0.766 then
|
||||
return -0.383
|
||||
else
|
||||
return EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM, -0.609, -0.383)
|
||||
end
|
||||
@@ -693,8 +700,14 @@ function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
||||
if vtN and ( abs( vtN:getY()) > 0.866) then
|
||||
return -0.708
|
||||
else
|
||||
if b3Raw:getDimZ() < 200 then
|
||||
return -0.5
|
||||
if b3Raw:getDimZ() < 120 then
|
||||
return -0.708
|
||||
elseif b3Raw:getDimZ() < 200 then
|
||||
if vtN and ( abs( vtN:getY()) < 0.259 or abs( vtN:getY()) > 0.819) then
|
||||
return -0.5
|
||||
else
|
||||
return -0.383
|
||||
end
|
||||
elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM then
|
||||
return -0.240
|
||||
else
|
||||
@@ -702,8 +715,6 @@ function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
return -0.484
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -550,6 +550,12 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
|
||||
-- Se esiste la superficie limitante (nFacet == 2) verifica se il taglio più esterno è superfluo e quindi viene eliminato
|
||||
if not bGetOrtoPlanes then
|
||||
VerifyFirstOrthoCut( UltimateTable, originalOffsetP, BBoxRawPart, dNzLimDwnUp)
|
||||
-- se rimangono due sole facce, devono coincidere con le originali e quindi sono superflue
|
||||
if #UltimateTable == 2 and #UltimateTable[1] == 1 and #UltimateTable[2] == 1 then
|
||||
EgtErase( UltimateTable[1][1])
|
||||
EgtErase( UltimateTable[2][1])
|
||||
UltimateTable = {}
|
||||
end
|
||||
end
|
||||
|
||||
return UltimateTable
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
-- FaceByPocket.lua by Egaltech s.r.l. 2022/05/82
|
||||
-- Gestione svuotatura di feature con una faccia
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local FaceByPocket = {}
|
||||
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
|
||||
EgtOutLog( ' FaceByPocket started', 1)
|
||||
|
||||
-- Dati
|
||||
local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function ApplyPocket( Proc, nSurfId, nFacet, sPocketing, nInd, dMaxElev, vtN)
|
||||
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nInd
|
||||
local nMchFId = EgtAddMachining( sName, sPocketing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nSurfId, nFacet}})
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
|
||||
if dMaxElev > 0.1 then
|
||||
-- imposto elevazione
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dMaxElev, 2) .. ';'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
end
|
||||
-- imposto posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM and not BD.TURN then
|
||||
nSCC = EgtIf( vtN:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid)
|
||||
local bOk = true
|
||||
local sErr
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dStep = 30
|
||||
local dMaxDepth = 100
|
||||
if EgtMdbSetCurrMachining( sPocketing) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
||||
local dElev = BL.GetFaceElevation( nSurfId, nFacet, nPartId)
|
||||
-- determino numero e valore degli step di lavorazione
|
||||
local nSurfStep = ceil( dElev / dMaxDepth)
|
||||
local dSurfStep = dElev / nSurfStep
|
||||
-- copio superfice al passo superfice e vi applico la lavorazione
|
||||
for i = nSurfStep, 2, -1 do
|
||||
local ptOn = ptC + ( dSurfStep * ( i - 1)) * vtN
|
||||
local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptOn, vtN, b3Solid, GDB_RT.GLOB)
|
||||
if nAddIdTmp then
|
||||
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
|
||||
-- aggiungo lavorazione
|
||||
bOk, sErr = ApplyPocket( Proc, nAddIdTmp, 0, sPocketing, i, dSurfStep, vtN)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
-- faccio ultima superfice
|
||||
bOk, sErr = ApplyPocket( Proc, nSurfId, nFacet, sPocketing, 1, EgtIf( nSurfStep > 1, dSurfStep, 0), vtN)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return FaceByPocket
|
||||
+43
-28
@@ -1,4 +1,4 @@
|
||||
-- FacesBySaw.lua by Egaltech s.r.l. 2022/04/12
|
||||
-- FacesBySaw.lua by Egaltech s.r.l. 2022/06/07
|
||||
-- Gestione taglio con lama di feature con una o due facce
|
||||
-- 2021/01/06 Cambiato limite per attacco Tg con lama e CalcLeadInOutGeom rinominata in CalcLeadInOutPerpGeom.
|
||||
-- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg.
|
||||
@@ -129,15 +129,21 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
local dLenLi2 = abs( dLi2Tang)
|
||||
local dLenLo2 = abs( dLo2Tang)
|
||||
-- scelgo l'attacco più conveniente (se non taglio praticamente longitudinale)
|
||||
local bTurnTang
|
||||
local Ktp = 1.1
|
||||
if BD.KIOTP then Ktp = BD.KIOTP end
|
||||
if ( not bDownUp or abs( vtTg:getY()) > 0.5) and
|
||||
( not bDownHead or abs( vtTg:getZ()) < 0.51) and
|
||||
abs( vtTg:getX()) < 0.9848 and
|
||||
( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5)) or
|
||||
( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or
|
||||
( abs( vtTg:getZ()) < 0.51 and b3Box:getDimZ() > 300 and BD.C_SIMM and BD.MAX_HEIGHT > 450) or
|
||||
( Ktp * dLenLi2 < dLenLi and Ktp * dLenLo2 < dLenLo) or Ktp * ( dLenLi2 + dLenLo2) < ( dLenLi + dLenLo)) then
|
||||
dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp
|
||||
if BD.TURN then
|
||||
bTurnTang = true
|
||||
dLoTang = -( dLiTang + dAllStart - dAccStart + dAllEnd - dAccEnd + dLen)
|
||||
dLoPerp = BD.COLL_SIC
|
||||
end
|
||||
end
|
||||
-- posizione braccio
|
||||
EgtOutLog( 'vtN=' .. tostring( vtN) .. ' vtRef=' .. tostring( vtRef) .. ' vtOut=' .. tostring( vtOut) .. ' vtAux=' .. tostring( vtAux), 3)
|
||||
@@ -149,10 +155,11 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
end
|
||||
else
|
||||
if abs( vtOut:getY()) > abs( vtOut:getZ()) then
|
||||
nSCC = EgtIf( ( vtAux:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
local vtTest = EgtIf( bTurnTang, EgtIf( bInvert, vtTg, -vtTg), vtOut)
|
||||
if abs( vtTest:getY()) > abs( vtTest:getZ()) then
|
||||
nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
nSCC = EgtIf( vtTest:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione di taglio
|
||||
@@ -180,6 +187,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
-- imposto attacco/uscita
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, dLiTang)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
|
||||
if bTurnTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
|
||||
-- imposto allungamenti iniziale e finale
|
||||
@@ -237,44 +245,54 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local ptM = ( ptT1 + ptT2) / 2
|
||||
local vtTg = ptT2 - ptT1 ;
|
||||
-- calcolo direzione di lavoro
|
||||
local vtRef = {}
|
||||
local vtTg = ptT2 - ptT1 ;
|
||||
vtRef[1] = vtN[1] ^ vtTg
|
||||
if vtRef[1] * vtN[2] < 0 then vtRef[1] = - vtRef[1] end
|
||||
vtRef[1]:normalize()
|
||||
if abs( vtRef[1]:getZ()) < 0.577 and abs( abs( vtRef[1]:getX()) - abs( vtRef[1]:getY())) < 0.1 then
|
||||
vtRef[1] = ptC[1] - ptM
|
||||
vtRef[1]:normalize()
|
||||
end
|
||||
vtRef[2] = vtN[2] ^ vtTg
|
||||
if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end
|
||||
vtRef[2]:normalize()
|
||||
if abs( vtRef[2]:getZ()) < 0.577 and abs( abs( vtRef[2]:getX()) - abs( vtRef[2]:getY())) < 0.1 then
|
||||
vtRef[2] = ptC[2] - ptM
|
||||
vtRef[2]:normalize()
|
||||
end
|
||||
-- determino quale faccia è più grande
|
||||
local ptPs = ( ptT1 + ptT2) / 2
|
||||
local dSqDim1 = ( ptC[1] - ptPs):sqlen()
|
||||
local dSqDim2 = ( ptC[2] - ptPs):sqlen()
|
||||
local dSqDim1 = ( ptC[1] - ptM):sqlen()
|
||||
local dSqDim2 = ( ptC[2] - ptM):sqlen()
|
||||
local nBigInd = EgtIf( dSqDim1 > dSqDim2 - 1., 1, 2)
|
||||
local nSmaInd = 3 - nBigInd
|
||||
local nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2)
|
||||
local nOtInd = 3 - nUpInd
|
||||
-- metto in relazione la scelta facce con il confronto del versore Z con la scelta in base alla grandezza faccia
|
||||
-- se la faccia più grande è messa secondaria e il suo versore Z non è negativo
|
||||
if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -5 * GEO.EPS_SMALL and vtN[nSmaInd]:getZ() < 0.866 then
|
||||
nOtInd = nSmaInd
|
||||
-- se la faccia più grande è messa secondaria e il suo versore Z non è troppo negativo
|
||||
if nOtInd == nBigInd and vtN[nBigInd]:getZ() > -0.5 and vtN[nSmaInd]:getZ() < 0.966 then
|
||||
nUpInd = nBigInd
|
||||
nOtInd = nSmaInd
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local sCutting = ML.FindCutting( sCutType, nil, bDownHead)
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||
local sErr = 'Error : cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dSawDiam = 400
|
||||
local dSawThick = 5
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
||||
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- calcolo extra taglio
|
||||
@@ -287,27 +305,26 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
if bDownHead then
|
||||
dNzLimDwnUp = - 2
|
||||
end
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico se necessari tagli supplementari
|
||||
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nUpInd], vtN[nUpInd], false, ptC[nOtInd], vtN[nOtInd])
|
||||
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nUpInd], vtN[nUpInd], false, ptC[nOtInd], vtN[nOtInd])
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- sistemo posizione nel DB e nome
|
||||
-- sistemo posizione nel DB, nome e info
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
end
|
||||
end
|
||||
-- con testa da sopra
|
||||
if not bDownHead then
|
||||
if not bDownHead or BD.TURN then
|
||||
-- eseguo
|
||||
for i = 1, #vCuts do
|
||||
-- assegno il modo di tagliare
|
||||
@@ -395,8 +412,6 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType,
|
||||
end
|
||||
end
|
||||
else
|
||||
nUpInd = EgtIf( vtN[1]:getZ() > vtN[2]:getZ() - GEO.EPS_SMALL, 1, 2)
|
||||
nOtInd = 3 - nUpInd
|
||||
-- se prima faccia lavorata è da sotto scambio le facce
|
||||
if vtN[nOtInd]:getZ() < -0.5 then
|
||||
nUpInd, nOtInd = nOtInd, nUpInd
|
||||
@@ -618,4 +633,4 @@ function FacesBySaw.CalcLeadInOutTangGeom( ptP1, ptP2, vtN, dRad, vtRef, dCutExt
|
||||
return dLiTang, dLiPerp, dLoTang, dLoPerp
|
||||
end
|
||||
|
||||
return FacesBySaw
|
||||
return FacesBySaw
|
||||
|
||||
@@ -356,7 +356,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead)
|
||||
end
|
||||
end
|
||||
local bH2, sOrigType = EndsWith( sType, '_H2')
|
||||
if ( not BEAM or not BEAM.BW) and MachineHeadUse == 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)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-- ProcessBlockHausFront.lua by Egaltech s.r.l. 2020/08/03
|
||||
-- Gestione calcolo giunzione block house in testa
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessBlockHausFront = {}
|
||||
@@ -43,7 +44,10 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -125,7 +129,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -141,7 +145,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
bCut = false
|
||||
end
|
||||
-- se di coda e coincide con taglio di separazione, non va fatto
|
||||
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
|
||||
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
bCut = false
|
||||
end
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
@@ -166,15 +170,14 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
|
||||
local vCuts = {}
|
||||
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
||||
elseif vFaceOrd[3] ~= 0 then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
|
||||
end
|
||||
if #vCuts > 0 then
|
||||
-- sistemo posizione nel DB e nome
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
end
|
||||
@@ -233,7 +236,7 @@ function ProcessBlockHausFront.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
bCut = false
|
||||
end
|
||||
-- se di coda e coincide con taglio di separazione, non va fatto
|
||||
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
|
||||
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
bCut = false
|
||||
end
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
|
||||
+84
-84
@@ -1,4 +1,4 @@
|
||||
-- ProcessCut.lua by Egaltech s.r.l. 2022/02/06
|
||||
-- ProcessCut.lua by Egaltech s.r.l. 2022/02/11
|
||||
-- Gestione calcolo singoli tagli di lama per Travi
|
||||
-- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito.
|
||||
-- 2021/06/06 Correzioni per tagli con testa da sotto.
|
||||
@@ -8,7 +8,8 @@
|
||||
-- 2022/01/26 Taglio da sotto orizzontale deve avere direzione di riferimento ortogonale -Z.
|
||||
-- 2022/02/02 Modifiche per tagli di coda spostati prima come lavorazione su pezzi a caduta.
|
||||
-- 2022/02/06 Correzioni per tagli di coda spostati prima.
|
||||
|
||||
-- 2022/05/31 Alcune modifiche per utilizzare la ProcessCut.Make in ProcessSplit e ProcessHeadCut, per le sezioni alte e larghe.
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessCut = {}
|
||||
|
||||
@@ -34,15 +35,15 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Classificazione della feature
|
||||
function ProcessCut.Classify( Proc, b3Raw)
|
||||
-- se PF con testa da sotto, ammessa qualunque orientazione
|
||||
if BD.C_SIMM and BD.DOWN_HEAD then
|
||||
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
|
||||
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
|
||||
return true
|
||||
end
|
||||
-- recupero i dati del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
if vtN:getZ() <= - 0.5 and abs( vtN:getY()) > 0.1 or ( vtN:getZ() <= - 0.174 and abs( vtN:getY()) > 0.866) then
|
||||
local _, DimH, DimV = BL.GetFaceHvRefDim( Proc.Id, 0)
|
||||
if DimH > BD.MAX_DIM_DICE then
|
||||
if DimH > BD.MAX_DIM_DICE and DimV > BD.MAX_DIM_DICE then
|
||||
return true, true
|
||||
end
|
||||
end
|
||||
@@ -194,7 +195,7 @@ end
|
||||
local function UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||
-- eventuale segnalazione ingombro di testa o coda (se non chiamata da altre feature)
|
||||
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
|
||||
if ProcessCut.Identify( Proc) and Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
|
||||
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
|
||||
if Proc.Head then
|
||||
local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||
if vtN:getZ() > 0.5 then
|
||||
@@ -221,17 +222,13 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione con testa da sopra
|
||||
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
|
||||
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
local sErr = 'Error : part box not found'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
|
||||
if not b3Raw then
|
||||
-- ingombro del grezzo
|
||||
b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
end
|
||||
-- ingombro del pezzo
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- dati geometrici del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- limiti di taglio (se molto di lato e inclinati sono permessi fino a -45deg)
|
||||
@@ -294,7 +291,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
end
|
||||
-- se vero taglio, eventuale inserimento smussi
|
||||
if Proc.Prc == 10 then
|
||||
if ProcessCut.Identify( Proc) then
|
||||
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOkc then return bOkc, sErrC end
|
||||
end
|
||||
@@ -316,6 +313,13 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
dCutH = min( dCutH, b3Raw:getDimY() / abs( frFac:getVersX():getY()))
|
||||
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA and not bDownCut)
|
||||
local bVertCutOk = ( dCutH < dMaxDepth - BD.CUT_EXTRA)
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico se necessari tagli supplementari
|
||||
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
|
||||
local vCuts = {}
|
||||
@@ -328,10 +332,14 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
vtExtra = X_AX()
|
||||
bAutoCalcSurf = false
|
||||
end
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
|
||||
if bForced then
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Raw, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
|
||||
else
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
|
||||
end
|
||||
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
|
||||
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
|
||||
end
|
||||
end
|
||||
-- se il ProcessCut viene lanciato dal ProcessSawCut e non ci sono tagli a cubetti, esco
|
||||
@@ -340,18 +348,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- sistemo posizione nel DB e nome
|
||||
local bOrthInv = false
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
if ( i % 2) == 1 then
|
||||
@@ -420,9 +420,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
if not BD.C_SIMM and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.707 end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- tutti gli altri casi vengono saltati
|
||||
-- caso generale
|
||||
@@ -444,10 +442,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
local dVzLimDwnUp = dNzLimDwnUp
|
||||
if not BD.C_SIMM and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -457,7 +453,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
local dVzLimDwnUp = dNzLimDwnUp
|
||||
local dCutExtra = BD.CUT_EXTRA
|
||||
if Proc.AdvTail then
|
||||
if bHorizCut then dVzLimDwnUp = 0 end
|
||||
if bHorizCut then dVzLimDwnUp = -0.01 end
|
||||
dCutExtra = -BD.ADVANCE_TAIL_OFFS
|
||||
end
|
||||
-- lavoro la faccia
|
||||
@@ -486,12 +482,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
-- taglio
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- Aggiornamento ingombro
|
||||
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -501,17 +493,11 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
|
||||
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
local sErr = 'Error : part box not found'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- dati geometrici del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- se vero taglio, eventuale inserimento smussi
|
||||
if Proc.Prc == 10 then
|
||||
if ProcessCut.Identify( Proc) then
|
||||
local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOkc then return bOkc, sErrC end
|
||||
end
|
||||
@@ -532,6 +518,13 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local frFac, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0)
|
||||
dCutH = min( dCutH, b3Raw:getDimY() / abs( frFac:getVersX():getY()))
|
||||
local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA) or Proc.AdvTail
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico se necessari tagli supplementari
|
||||
EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3)
|
||||
local vCuts = {}
|
||||
@@ -544,22 +537,14 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
vtExtra = X_AX()
|
||||
bAutoCalcSurf = false
|
||||
end
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, nil ,true)
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, nil ,true)
|
||||
end
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- sistemo posizione nel DB e nome
|
||||
local bOrthInv = false
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
if ( i % 2) == 1 then
|
||||
@@ -638,9 +623,7 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- taglio parallelo (limite Vz Down Up messo a -2 per non farlo mai intervenire)
|
||||
if vCuts[i+1][j] then
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i+1][j], 0, sCutting, dSawDiam, vtOrthoO_2, -2, dExtraCut_2, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -681,42 +664,52 @@ local function MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dCutExtra = min( -BD.ADVANCE_TAIL_OFFS, dMaxVertDepth - dCutV)
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, -2, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- Aggiornamento ingombro
|
||||
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
if not b3Raw then
|
||||
-- ingombro del grezzo
|
||||
b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
end
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
local sErr = 'Error : part box not found'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- dati geometrici del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- se taglio di testa
|
||||
if Proc.Head then
|
||||
-- se coincide con il taglio di separazione precedente, non va fatto
|
||||
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
|
||||
if not bForced then
|
||||
if Proc.Head then
|
||||
-- se coincide con il taglio di separazione precedente, non va fatto
|
||||
if AreSameVectorApprox( vtN, X_AX()) and abs( ptC:getX() - b3Raw:getMax():getX() + dOvmHead) < 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
end
|
||||
-- altrimenti taglio di coda
|
||||
else
|
||||
-- se coincide con taglio di separazione, non va fatto
|
||||
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
end
|
||||
end
|
||||
-- se coincide con un taglio frontale non va fatto
|
||||
if Proc.CutFront then
|
||||
return true
|
||||
end
|
||||
-- altrimenti taglio di coda
|
||||
else
|
||||
-- se coincide con taglio di separazione, non va fatto
|
||||
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
end
|
||||
end
|
||||
-- se coincide con un taglio frontale non va fatto
|
||||
if Proc.CutFront then
|
||||
return true
|
||||
end
|
||||
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione larga o pezzo corto)
|
||||
local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and
|
||||
( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART))
|
||||
local bDownTurn = ( BD.TURN and vtN:getZ() < -0.017)
|
||||
local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead))
|
||||
-- recupero la lavorazione
|
||||
local sCutType = EgtIf( Proc.Head, 'HeadSide', 'TailSide')
|
||||
@@ -728,12 +721,19 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
||||
return false, sErr
|
||||
end
|
||||
-- se taglio con testa da sopra
|
||||
if not bDownHead then
|
||||
return MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
|
||||
if not bDownHead and not bDownTurn then
|
||||
local bOk, sErr = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
|
||||
if not bOk then return false, sErr end
|
||||
-- altrimenti taglio con testa da sotto
|
||||
else
|
||||
return MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
|
||||
local bOk, sErr = MakeFromDown( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- Aggiornamento ingombro (se vero taglio o richiesto)
|
||||
if ProcessCut.Identify( Proc) or bUpdateIng then
|
||||
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -176,7 +176,7 @@ end
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se singola faccia, passo a quella lavorazione
|
||||
if Proc.Fct == 1 then return Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end
|
||||
if Proc.Fct == 1 then return Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true) end
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -235,9 +235,9 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = 10, Box = b3Add, Fct = 1, Flg = Proc.Flg,
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- creo piano di taglio coincidente con la seconda faccia e lo lavoro
|
||||
@@ -247,67 +247,17 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
local b3Add = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
|
||||
-- applico lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = 10, Box = b3Add, Fct = 1, Flg = Proc.Flg,
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Add, Fct = 1, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, nil, nil, bForced, b3Raw, sNotes, dOvmTail, true)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
-- altrimenti concavo
|
||||
else
|
||||
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -30deg)
|
||||
local bTopHead = ( BD.DOWN_HEAD and vtNm:getZ() > -0.5)
|
||||
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < -0.5)
|
||||
-- recupero la lavorazione
|
||||
-- eseguo
|
||||
local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide')
|
||||
local sCutting
|
||||
sCutting, bDownHead = ML.FindCutting( sCutType, bTopHead, bDownHead)
|
||||
if not sCutting then
|
||||
local sErr = 'Error : cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local dSawDiam = 400
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- verifico se necessari tagli supplementari
|
||||
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 then
|
||||
-- aggiorno nome e info
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
end
|
||||
end
|
||||
-- eseguo
|
||||
for i = 1, #vCuts do
|
||||
-- determino il modo di tagliare
|
||||
local vtOrthOpp = vtN[nBigInd]
|
||||
local vtNorm = vtN[nSmaInd]
|
||||
if ( i % 2) ~= 1 then vtOrthOpp, vtNorm = vtNorm, vtOrthOpp end
|
||||
-- lavoro la faccia
|
||||
for j = 1, #vCuts[i] do
|
||||
local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthOpp, EgtIf( bDownHead, -2, nil), 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
-- altrimenti, tagli diretti delle facce
|
||||
else
|
||||
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType .. EgtIf( bDownHead, '_H2', ''), false, bDownHead)
|
||||
if not bOk then
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- segnalazione ingombro di testa o coda
|
||||
if Proc.Head then
|
||||
-- intersezioni con linee a metà altezza appena dentro dal davanti e dal dietro
|
||||
|
||||
+14
-10
@@ -1,5 +1,6 @@
|
||||
-- ProcessDovetail.lua by Egaltech s.r.l. 2021/02/04
|
||||
-- Gestione calcolo giunzione coda di rondine
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessDovetail = {}
|
||||
@@ -226,7 +227,7 @@ local function AddFaceToSurf( Proc, nPartId, b3Solid)
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -656,7 +657,7 @@ local function MakeByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3So
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -1380,7 +1381,7 @@ local function Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
|
||||
local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
|
||||
|
||||
-- recupero la geometria ausiliaria
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
@@ -1389,7 +1390,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
|
||||
-- recupero il centro e la normale della faccia ausiliaria
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( AuxId, 0, GDB_ID.ROOT)
|
||||
if not vtN then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' wrong Normal of AuxSurface'
|
||||
local sErr = 'Error : wrong Normal of AuxSurface'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -1398,7 +1399,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
|
||||
-- recupero la lavorazione per la geometria ausiliaria
|
||||
local sCutting = ML.FindCutting( 'HeadSide')
|
||||
if not sCutting then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' cutting not found in library'
|
||||
local sErr = 'Error : cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -1415,7 +1416,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -1427,7 +1428,7 @@ local function MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Sol
|
||||
return true
|
||||
end
|
||||
-- verifico se coincide con taglio di coda
|
||||
if not bHead and AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
|
||||
if not bHead and AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
end
|
||||
-- inserisco la lavorazione
|
||||
@@ -1710,7 +1711,10 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- in base al tipo di feature attribuisco il significato dei parametri Q
|
||||
@@ -1735,7 +1739,7 @@ function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se ha due facce ( allora è di testa o coda)
|
||||
if Proc.Fct == 2 then
|
||||
-- eventuale taglio di testa o coda
|
||||
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
|
||||
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
|
||||
if not bAuxOk then return bAuxOk, sAuxErr end
|
||||
-- lavorazione della feature
|
||||
local bOk, sErr = Make2Faces( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, bForceUseRough)
|
||||
@@ -1743,7 +1747,7 @@ function ProcessDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se ha 3 facce ed è di testa o coda
|
||||
elseif Proc.Fct == 3 and ( Proc.Head or Proc.Tail) then
|
||||
-- eventuale taglio di testa o coda
|
||||
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid)
|
||||
local bAuxOk, sAuxErr = MakeAuxCut( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, dOvmTail)
|
||||
if not bAuxOk then return bAuxOk, sAuxErr end
|
||||
-- lavorazione della feature
|
||||
if bForceUseRough then
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
-- 2022/03/26 DS Correzioni per fori testa-fianco nel piano.
|
||||
-- 2022/03/29 DS Corretta assegnazione fori molto inclinati fianco/coda a coda.
|
||||
-- 2022/04/21 DS Corretto riconoscimento fori di coda.
|
||||
-- 2022/06/22 Nel riconoscimento fori di coda si utilizza ora il reale sovramateriale di coda (dOvmTail) invece di BD.OVM_MID.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessDrill = {}
|
||||
@@ -55,9 +56,12 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Verifica se feature di coda
|
||||
function ProcessDrill.IsTailFeature( Proc, b3Raw)
|
||||
function ProcessDrill.IsTailFeature( Proc, b3Raw, dOvmTail)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
-- verifico se è in coda
|
||||
if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + BD.OVM_MID + BD.MAX_DIST_HTFEA then
|
||||
if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + dOvmTail + BD.MAX_DIST_HTFEA then
|
||||
return false
|
||||
end
|
||||
-- recupero e verifico l'entità foro
|
||||
@@ -120,7 +124,7 @@ function ProcessDrill.Split( Proc, b3Raw)
|
||||
local bHoriz = ( abs( vtExtr:getZ()) < abs( BD.DRILL_VZ_MIN) and
|
||||
( abs( vtExtr:getY()) * b3Raw:getDimZ() > abs( vtExtr:getZ()) * b3Raw:getDimY() or Proc.Fce == 5 or Proc.Fce == 6))
|
||||
local bSlant = ( abs( vtExtr:getX()) > BD.DRILL_VX_MAX)
|
||||
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD) and not bSlant)
|
||||
return ( bOpen and ( bHoriz or BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and not bSlant)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/05/01
|
||||
-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/06/07
|
||||
-- Gestione calcolo mortase a coda di rondine per Travi
|
||||
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
|
||||
-- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto.
|
||||
-- 2021/06/28 Aggiunta gestione attacco e uscita con pocket.
|
||||
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
|
||||
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
|
||||
-- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessDtMortise = {}
|
||||
@@ -59,6 +60,10 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Classificazione della feature
|
||||
function ProcessDtMortise.Classify( Proc)
|
||||
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
|
||||
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
|
||||
return true
|
||||
end
|
||||
-- recupero i dati della curva di contorno della faccia di fondo
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
|
||||
if not AuxId then return false end
|
||||
@@ -119,6 +124,21 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol
|
||||
return NewAuxId
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- verifica che il box includa il punto in XY
|
||||
function EnclosesPoint( b3Box, ptP)
|
||||
if b3Box[2][1] < ptP[1] - GEO.EPS_SMALL or b3Box[1][1] > ptP[1] + GEO.EPS_SMALL then
|
||||
return false
|
||||
end
|
||||
if b3Box[2][2] < ptP[2] - GEO.EPS_SMALL or b3Box[1][2] > ptP[2] + GEO.EPS_SMALL then
|
||||
return false
|
||||
end
|
||||
if b3Box[2][3] < ptP[3] - GEO.EPS_SMALL or b3Box[1][3] > ptP[3] + GEO.EPS_SMALL then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
@@ -142,7 +162,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
|
||||
-- verifico che la mortasa non sia orientata verso il basso (-5 deg) o che ci sia una testa da sotto o un rinvio angolare
|
||||
local bFaceDown = ( vtExtr:getZ() < -0.1)
|
||||
if bFaceDown and not BD.DOWN_HEAD and not BD.ANG_TRASM then
|
||||
if bFaceDown and not BD.DOWN_HEAD and not BD.TURN and not BD.ANG_TRASM then
|
||||
local sErr = 'Machining from bottom impossible : Error on DtMortise ' .. tostring( Proc.Id)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
@@ -151,6 +171,9 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local rfDtMrt, dLenMrt, dWidthMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB)
|
||||
local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
|
||||
local dAltMort = b3DtMrt:getDimZ()
|
||||
-- ne determino l'asse (valido se non pocket)
|
||||
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
|
||||
vtAx:normalize()
|
||||
-- verifico se di tipo pocket
|
||||
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
|
||||
if bPocket then bMakeAntiSplitPath = false end
|
||||
@@ -296,12 +319,21 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
-- eventuale calcolo SCC
|
||||
local nSCC
|
||||
if BD.TURN and not bPocket then
|
||||
if abs( vtAx:getY()) > abs( vtAx:getZ()) then
|
||||
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||
end
|
||||
end
|
||||
-- se parametro interno abilitato e il percorso non è chiuso, aggiungo percorso e lavorazione antischeggia
|
||||
if bMakeAntiSplitPath and not EgtCurveIsClosed( AuxId) then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -346,7 +378,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
nId1 = EgtArc2PV( nAddGrpId, ptStart, ptEnd, vtTg, GDB_RT.GLOB)
|
||||
end
|
||||
if not nId1 then
|
||||
local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id)
|
||||
local sErr = 'Wrong geometry : Error on DtMortise '
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -368,6 +400,10 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- sistemo il lato e la direzione di lavoro
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
|
||||
-- se necessario, imposto SCC
|
||||
if nSCC then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
end
|
||||
-- dichiaro non si generano sfridi per VMill
|
||||
local sUserNotes = 'MaxElev='.. EgtNumToString( dAltMort, 1) .. '; VMRS=0;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
@@ -390,8 +426,6 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
-- verifico se necessarie più passate (distanza all'imbocco ortogonale all'asse)
|
||||
local vtDiff = EgtEP( AuxId, GDB_RT.GLOB) - EgtSP( AuxId, GDB_RT.GLOB)
|
||||
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
|
||||
vtAx:normalize()
|
||||
local vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx
|
||||
local dDist = min( vtOrtDiff:len(), dWidthMrt)
|
||||
-- calcolo le passate
|
||||
@@ -424,6 +458,27 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, dToolDiam / 2)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, 5)
|
||||
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
|
||||
-- altrimenti verifico se sono bilanciati ingresso e uscita, per evitare inizio o fine nel legno
|
||||
else
|
||||
local ptS = EgtSP( AuxId, GDB_ID.ROOT)
|
||||
local ptE = EgtEP( AuxId, GDB_ID.ROOT)
|
||||
local dDistS = abs( ( ptS - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
|
||||
local dDistE = abs( ( ptE - rfDtMrt:getOrigin()) * rfDtMrt:getVersX())
|
||||
local dIni, dFin = EgtCurveDomain( AuxId)
|
||||
local nCrvCnt = dFin - dIni - 1
|
||||
if abs( dDistS - dDistE) > 20 then
|
||||
local b3Test = BBox3d( b3Solid)
|
||||
b3Test:expand( -5)
|
||||
if dDistS < dDistE and EnclosesPoint( b3Test, ptS) and EgtCurveCompoAngCenter( AuxId, 0) == 0 then
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dDistE - dDistS)
|
||||
elseif dDistE < dDistS and EnclosesPoint( b3Test, ptE) and EgtCurveCompoAngCenter( AuxId, nCrvCnt) == 0 then
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dDistS - dDistE)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se necessario, imposto SCC
|
||||
if nSCC then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
end
|
||||
-- dichiaro non si generano sfridi per VMill
|
||||
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessTenon.lua by Egaltech s.r.l. 2022/04/14
|
||||
-- ProcessTenon.lua by Egaltech s.r.l. 2022/06/07
|
||||
-- Gestione calcolo tenone a coda di rondine per Travi
|
||||
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
|
||||
-- 2022/04/14 Aumentati un poco i limiti di orientamento verso il basso per FAST e PF.
|
||||
@@ -20,8 +20,8 @@ local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function VerifyOrientation( Proc, vtN, b3Raw)
|
||||
-- se PF con testa da sotto, ammessa qualunque orientazione
|
||||
if BD.C_SIMM and BD.DOWN_HEAD then
|
||||
-- se PF con testa da sotto o TURN, ammessa qualunque orientazione
|
||||
if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then
|
||||
return true
|
||||
end
|
||||
-- se trave molto bassa
|
||||
@@ -160,6 +160,9 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
|
||||
-- porto inizio curva a Zmax
|
||||
BL.PutStartOnTop( AuxId)
|
||||
-- ne determino l'asse
|
||||
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
|
||||
vtAx:normalize()
|
||||
-- se tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
|
||||
if not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
|
||||
( Proc.Box:getMax():getX() < b3Raw:getMax():getX() - dOvmHead - 100 * GEO.EPS_SMALL and
|
||||
@@ -302,7 +305,13 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
|
||||
-- imposto posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM then
|
||||
if BD.TURN then
|
||||
if abs( vtAx:getY()) > abs( vtAx:getZ()) then
|
||||
nSCC = EgtIf( vtAx:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
nSCC = EgtIf( vtAx:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||
end
|
||||
elseif not BD.C_SIMM then
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
if abs( vtExtr:getY()) > 0.088 then
|
||||
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-- ProcessFrenchRidgeLap.lua by Egaltech s.r.l. 2020/02/11
|
||||
-- Gestione calcolo giunzione francese
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessFrenchRidgeLap = {}
|
||||
@@ -38,7 +39,10 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -117,25 +121,24 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local dFinalExtraTrim = 0.1
|
||||
local dMiddleExtraTrim = 0.3
|
||||
local dNullExtraTrim = 0
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
|
||||
local vCuts = {}
|
||||
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
||||
elseif vFaceOrd[3] ~= 0 then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
|
||||
end
|
||||
if #vCuts > 0 then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- sistemo posizione nel DB e nome
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
end
|
||||
@@ -192,7 +195,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
bCut = false
|
||||
end
|
||||
-- se di coda e coincide con taglio di separazione, non va fatto
|
||||
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
|
||||
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
bCut = false
|
||||
end
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
@@ -212,7 +215,7 @@ function ProcessFrenchRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
bCut = false
|
||||
end
|
||||
-- se di coda e coincide con taglio di separazione, non va fatto
|
||||
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
|
||||
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
bCut = false
|
||||
end
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2022/06/07
|
||||
-- Gestione calcolo tagli di testa per Travi
|
||||
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio di tipo diceCut.
|
||||
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessHeadCut = {}
|
||||
@@ -8,6 +10,8 @@ local ProcessHeadCut = {}
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
local Cut = require( 'ProcessCut')
|
||||
local Pocket = require( 'FaceByPocket')
|
||||
|
||||
EgtOutLog( ' ProcessHeadCut started', 1)
|
||||
|
||||
@@ -170,10 +174,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
end
|
||||
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
||||
-- caratteristiche taglio
|
||||
local bHorizCut = (( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
|
||||
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM)
|
||||
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( b3Raw:getDimZ() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
|
||||
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||
-- dati geometrici del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- se non obbligatorio e coincide con inizio grezzo, non va fatto
|
||||
@@ -183,8 +188,33 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
-- determino se più tagli con offset
|
||||
local nCuts = max( ceil( dOvmHead / ( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP)), 1)
|
||||
local dOffsL = dOvmHead / nCuts
|
||||
-- se taglio per sezioni alte e larghe
|
||||
if bBigSectionCut then
|
||||
if dOvmHead > 0 then
|
||||
-- se finitura con lama
|
||||
if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 then
|
||||
local bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- se finitura con truciolatore
|
||||
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
local sErr = 'Error : part box not found'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, 0)
|
||||
if not sPocketing then
|
||||
local sErr = 'Error : pocketing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
-- se tagli standard
|
||||
if not bDoubleHorizCut then
|
||||
elseif not bDoubleHorizCut then
|
||||
-- flag di lavorazione faccia
|
||||
local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT)
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
|
||||
+320
-135
@@ -1,4 +1,4 @@
|
||||
-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/05/04
|
||||
-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/06/15
|
||||
-- Gestione calcolo mezzo-legno per Travi
|
||||
-- 2019/10/08 Agg. gestione OpenPocket.
|
||||
-- 2021/01/24 Con sega a catena ora sempre impostato asse A.
|
||||
@@ -41,6 +41,12 @@
|
||||
-- 2022/03/29 Aggiunta gestione antischeggia con Q06 anche su 3/4-033-X.
|
||||
-- 2022/04/28 Lavorazione BH forzata sempre OneWay.
|
||||
-- 2022/05/04 Corretta classificazione due facce sotto. Modificati criteri assegnazione due facce alla coda.
|
||||
-- 2022/05/24 Miglioramenti vari per BH, compreso controlli per lavorazione da sotto.
|
||||
-- 2022/05/31 Rese globali le funzioni GetChainSawBlockedAxis e GetChainSawInitAngs per essere richiamate dalla ProcessSplit per taglio sega a catena in sezioni alte e larghe.
|
||||
-- 2022/06/13 Modifiche per feature lunga con due facce non equivalenti a taglio long. doppio o singolo con faccia terminale.
|
||||
-- 2022/06/15 Correzione calcolo normale alla faccia per sega catena di fianco.
|
||||
-- 2022/06/16 Implemento lavorazioni con fresatura di lato per L30 (al momento solo passanti) se parametro Q03=2. Modificate funzioni Make, MakeMoreFaces, Classify.
|
||||
-- 2022/06/21 Implemento di lavorazioni non passanti con fresatura di lato per L30 se parametro Q03=2. Modificate funzioni MakeMoreFaces, Classify.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessLapJoint = {}
|
||||
@@ -254,7 +260,7 @@ local function TestElleShape4( Proc)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetChainSawBlockedAxis( nInd)
|
||||
function ProcessLapJoint.GetChainSawBlockedAxis( nInd)
|
||||
if BD.GetChainSawBlockedAxis then
|
||||
return BD.GetChainSawBlockedAxis( nInd)
|
||||
else
|
||||
@@ -267,14 +273,14 @@ local function GetChainSawBlockedAxis( nInd)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetChainSawInitAngs( vtN, vtO, nInd)
|
||||
function ProcessLapJoint.GetChainSawInitAngs( vtN, vtO, nInd)
|
||||
if BD.GetChainSawInitAngs then
|
||||
return BD.GetChainSawInitAngs( vtN, vtO, nInd)
|
||||
else
|
||||
if BD.C_SIMM then
|
||||
return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180')
|
||||
else
|
||||
if nInd ==1 then
|
||||
if nInd == 1 then
|
||||
return ''
|
||||
else
|
||||
return EgtIf( vtN:getY() > 0, 'C=180', 'C=-180')
|
||||
@@ -382,7 +388,7 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
|
||||
-- le facce devono contenere X e quelle di chiusura devono essere perpendicolari a X
|
||||
local bStopY, bStopZ
|
||||
for i = 1, Proc.Fct do
|
||||
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT)
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, i-1, GDB_ID.ROOT)
|
||||
if abs( vtN:getX()) > 0.001 and abs( vtN:getX()) < 0.999962 then
|
||||
return false
|
||||
end
|
||||
@@ -412,20 +418,35 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
|
||||
-- recupero i dati dell'utensile
|
||||
local dToolLength = 0
|
||||
local dToolDiam = 0
|
||||
local dMaxDepth = 0
|
||||
local dThickTool = 0
|
||||
local dToolMaxDepth = 0
|
||||
local dToolThick = 0
|
||||
local dToolFreeLen = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolLength = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dToolLength
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
dThickTool = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dThickTool
|
||||
local dToolThDiam = EgtTdbGetCurrToolThDiam() or 150
|
||||
if ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE) ~= 0 then
|
||||
dToolMaxDepth = EgtTdbGetCurrToolMaxDepth() or dToolMaxDepth
|
||||
dToolThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dToolThick
|
||||
dToolFreeLen = dToolLength
|
||||
else
|
||||
dToolMaxDepth = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 0.5 * ( dToolDiam - dToolThDiam)
|
||||
dToolThick = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
|
||||
dToolFreeLen = EgtTdbGetCurrToolMaxDepth() or dToolFreeLen
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- verifico se abbastanza larga (oppure L) rispetto all'utensile
|
||||
if Proc.Box:getDimX() < dThickTool - 15 * GEO.EPS_SMALL and not bIsL then
|
||||
if Proc.Box:getDimX() < dToolThick - 15 * GEO.EPS_SMALL and not bIsL then
|
||||
return false
|
||||
end
|
||||
|
||||
-- limiti trasversali
|
||||
local dDepth = min( Proc.Box:getDimY(), Proc.Box:getDimZ())
|
||||
if dDepth > dToolMaxDepth then
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -440,14 +461,14 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
|
||||
local bHead = bHeadDir
|
||||
|
||||
-- verifico se raggiungibile con la testa senza collisioni
|
||||
local bUseBHSideMill = EgtIf( bHead, ( dMaxT - dMinXF), ( dMaxXF - dMinT)) < dMaxDepth
|
||||
local bUseBHSideMill = EgtIf( bHead, ( dMaxT - dMinXF), ( dMaxXF - dMinT)) < dToolFreeLen
|
||||
-- se diametro utensile maggiore della testa
|
||||
if BD.HEAD_DIM_FOR_BH and dToolDiam > BD.HEAD_DIM_FOR_BH then
|
||||
if BD.HEAD_DIM_FOR_BH and dToolDiam - 2 * dDepth > BD.HEAD_DIM_FOR_BH then
|
||||
bHead = true
|
||||
bUseBHSideMill = true
|
||||
end
|
||||
|
||||
return bUseBHSideMill, bHead, bHeadDir, sMilling, dThickTool, dToolDiam
|
||||
return bUseBHSideMill, bHead, bHeadDir, sMilling, dToolThick, dToolDiam
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -557,6 +578,29 @@ local function CalcCollisionSafety( vtDir)
|
||||
return dCollSic
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
|
||||
-- verifico siano una o due facce
|
||||
if Proc.Fct > 2 then return end
|
||||
-- eventuale segnalazione ingombro di testa o coda
|
||||
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
|
||||
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
|
||||
if Proc.Head then
|
||||
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
||||
BL.UpdateHCING( nRawId, dOffs)
|
||||
elseif Proc.Tail then
|
||||
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||
BL.UpdateTCING( nRawId, dOffs)
|
||||
elseif Proc.Fct > 1 and Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then
|
||||
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
||||
local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX()
|
||||
-- sempre concavo aumento la distanza (rimane una punta...)
|
||||
dDist = dDist + 10
|
||||
BL.UpdateHCING( nRawId, dOffs, dDist)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Verifica se feature di testa
|
||||
function ProcessLapJoint.IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
@@ -627,9 +671,9 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw)
|
||||
if dEndDist > BD.MAX_DIST_HTFEA then
|
||||
return false
|
||||
end
|
||||
-- se lunga come trave, oppure non è trave corta e la sua lunghezza supera il massimo o il 60% della lunghezza della trave
|
||||
-- se lunga come trave, oppure non è trave corta e la sua lunghezza supera il massimo o il 70% della lunghezza della trave
|
||||
if Proc.Box:getDimX() > b3Solid:getDimX() - 1 or
|
||||
( b3Solid:getDimX() > BD.LEN_SHORT_PART and Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.6 * b3Solid:getDimX())) then
|
||||
( b3Solid:getDimX() > BD.LEN_SHORT_PART and Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.7 * b3Solid:getDimX())) then
|
||||
return false
|
||||
end
|
||||
-- se una o due facce e interessa veramente la coda, allora di coda
|
||||
@@ -660,11 +704,6 @@ end
|
||||
function ProcessLapJoint.Classify( Proc, b3Raw)
|
||||
-- se 1 faccia
|
||||
if Proc.Fct == 1 then
|
||||
-- dati della faccia
|
||||
--local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- verifico se è lavorabile solo dal basso
|
||||
--local bDown = ( vtN:getZ() < BD.NZ_MINA)
|
||||
--return true, bDown
|
||||
return true, false
|
||||
-- se 2 facce
|
||||
elseif Proc.Fct == 2 then
|
||||
@@ -685,7 +724,9 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
|
||||
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[2]:getZ() < BD.NZ_MINA and vtN[1]:getZ() < 0.5 and ( vtN[1]:getZ() < -0.1 or not bSmall))
|
||||
bDown = ( bDown and not BD.DOWN_HEAD and not BD.TURN)
|
||||
-- per L30, se forzata la lavorazione con fresa di lato da parametro Q03=2 non devo ruotare
|
||||
local bForceSideMill = ( Proc.Prc == 30 and EgtGetInfo( Proc.Id, 'Q03', 'd') == 2)
|
||||
bDown = ( bDown and not BD.DOWN_HEAD and not BD.TURN and not bForceSideMill)
|
||||
return true, bDown
|
||||
-- se più di 2 facce
|
||||
else
|
||||
@@ -764,9 +805,14 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
|
||||
rfFac:rotate( rfFac:getOrigin(), rfFac:getVersZ(), 90)
|
||||
end
|
||||
-- se può essere fatto con utensile tipo lama
|
||||
local bUseBHSideMill = VerifyBHSideMill( Proc)
|
||||
local bUseBHSideMill, _, _, _, _, dTDiam = VerifyBHSideMill( Proc)
|
||||
if bUseBHSideMill then
|
||||
return true, false
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
if vtN:getZ() > -0.5 or b3Raw:getDimZ() - Proc.Box:getDimZ() < ( BD.MAX_DIST_BH_FROM_BOTTOM or 395) - dTDiam / 2 then
|
||||
return true, false
|
||||
else
|
||||
return true, true
|
||||
end
|
||||
-- altrimenti controllo se deve essere ruotato con le altre lavorazioni
|
||||
else
|
||||
-- dati della faccia
|
||||
@@ -778,7 +824,12 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
|
||||
local bDown = ( vtN:getZ() < BD.NZ_MINA and not BD.DOWN_HEAD and not BD.TURN)
|
||||
-- se verso il basso, verifico se utilizzabile seconda faccia
|
||||
if bDown then
|
||||
if nFacInd2 and dElev2 < 2 * dElev then
|
||||
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 non devo ruotare
|
||||
local bForceSideMill = ( Proc.Prc == 30 and EgtGetInfo( Proc.Id, 'Q03', 'd') == 2 and ( Proc.Fct == 3 or Proc.Fct == 4))
|
||||
if bForceSideMill then
|
||||
bDown = false
|
||||
elseif nFacInd2 and dElev2 < 2 * dElev then
|
||||
local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
|
||||
bDown = ( vtN2:getZ() < BD.NZ_MINB)
|
||||
elseif not nFacInd2 and bIsL and nFaceAdj >= 0 then
|
||||
@@ -863,16 +914,7 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
|
||||
return false, sErr
|
||||
end
|
||||
-- eventuale segnalazione ingombro di testa o coda
|
||||
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
|
||||
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
|
||||
if Proc.Head then
|
||||
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
||||
BL.UpdateHCING( nRawId, dOffs)
|
||||
elseif Proc.Tail then
|
||||
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||
BL.UpdateTCING( nRawId, dOffs)
|
||||
end
|
||||
end
|
||||
UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -1040,22 +1082,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead)
|
||||
return false, sErr
|
||||
end
|
||||
-- eventuale segnalazione ingombro di testa o coda
|
||||
local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ())
|
||||
if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then
|
||||
if Proc.Head then
|
||||
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
||||
BL.UpdateHCING( nRawId, dOffs)
|
||||
elseif Proc.Tail then
|
||||
local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||
BL.UpdateTCING( nRawId, dOffs)
|
||||
elseif Proc.Box:getCenter():getX() > b3Solid:getCenter():getX() then
|
||||
local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX()
|
||||
local dDist = b3Solid:getMax():getX() - Proc.Box:getMax():getX()
|
||||
-- sempre concavo aumento la distanza (rimane una punta...)
|
||||
dDist = dDist + 10
|
||||
BL.UpdateHCING( nRawId, dOffs, dDist)
|
||||
end
|
||||
end
|
||||
UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -2664,7 +2691,6 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
|
||||
if bOrthoFaces then
|
||||
-- ottengo le dimensioni del tunnel
|
||||
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId)
|
||||
@@ -2989,10 +3015,10 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
||||
end
|
||||
-- se continuo a lavorare di testa
|
||||
if bGoFromHead then
|
||||
-- Calcolo uso faccia
|
||||
local nFaceUse = BL.GetNearestParalOpposite( rfFac:getVersZ())
|
||||
-- Calcolo normale faccia adiacente
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacAdj, GDB_ID.ROOT)
|
||||
-- Calcolo uso faccia
|
||||
local nFaceUse = BL.GetNearestParalOpposite( rfFac:getVersZ(), vtN)
|
||||
-- Verifico se necessarie più passate
|
||||
local nStep = ceil( ( dV - 10 * GEO.EPS_SMALL) / dSawThick)
|
||||
local dStep = 0
|
||||
@@ -3036,8 +3062,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, 0, - dSawWidth / 2))
|
||||
end
|
||||
-- imposto angolo 3° asse rot e eventuale angolo suggerito per inizio
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 1))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, rfFac:getVersZ(), 1))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 1))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 1))
|
||||
-- imposto offset radiale
|
||||
local dOffs = ( i - 1) * dStep
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||
@@ -3059,8 +3085,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
||||
return false, sErr
|
||||
end
|
||||
-- impostazione alternativa angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, rfFac:getVersZ(), 2))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, rfFac:getVersZ(), 2))
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
@@ -3078,10 +3104,12 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
||||
-- verifico se posso farlo con la sega-catena
|
||||
local bMakeChainSaw, sSawing2, dMaxMat2, dSawCornerRad2, dSawThick2 = VerifyChainSaw( Proc, dDimMin, dDimMax)
|
||||
if bMakeChainSaw then
|
||||
-- Calcolo normale faccia da lavorare
|
||||
local vtNL = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT)
|
||||
-- Calcolo uso faccia
|
||||
local vtRef = Vector3d( vtOrtho)
|
||||
if vtRef:getY() > 0.5 or vtRef:getZ() < -0.1 then vtRef = -vtRef end
|
||||
local nFaceUse = BL.GetNearestParalOpposite( vtRef, vtN)
|
||||
local nFaceUse = BL.GetNearestParalOpposite( vtRef, vtNL)
|
||||
-- Verifico se necessarie più passate
|
||||
local nStep = ceil( ( dDimMin - 10 * GEO.EPS_SMALL) / dSawThick2)
|
||||
local dStep = 0
|
||||
@@ -3102,8 +3130,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
||||
-- imposto uso del lato faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- imposto angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 1))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 1))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtNL, vtOrtho, 1))
|
||||
-- imposto offset radiale
|
||||
local dOffs = ( i - 1) * dStep
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||
@@ -3133,8 +3161,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
||||
return false, sErr
|
||||
end
|
||||
-- impostazione alternativa angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho, 2))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtNL, vtOrtho, 2))
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
@@ -3215,7 +3243,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng)
|
||||
local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng, bOpenOutRaw)
|
||||
|
||||
-- calcolo l'elevazione dal punto medio
|
||||
local dElev
|
||||
@@ -3318,6 +3346,9 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo
|
||||
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
|
||||
sNotes = sNotes .. 'VMRS=0;'
|
||||
if bOpenOutRaw then
|
||||
sNotes = sNotes .. 'OpenOutRaw=1;'
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
-- provo ad allargare leggermente la tasca
|
||||
@@ -3532,7 +3563,7 @@ local function GetUShapeWidth( Proc, nFacInd)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown)
|
||||
local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders)
|
||||
|
||||
local nFirstMachId
|
||||
local bOrthoFaces
|
||||
@@ -3590,8 +3621,8 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
-- e assegno l'estrusione
|
||||
nPathInt = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId)
|
||||
EgtModifyCurveExtrusion( nPathInt, vtOrtho, GDB_RT.GLOB)
|
||||
-- se ho 3 facce, ciclo sulle entià del percorso per segnare quelle che sono aperte
|
||||
if bIs3Faces then
|
||||
-- se ho 3 facce oppure se forzato, ciclo sulle entià del percorso per segnare quelle che sono aperte.
|
||||
if bIs3Faces or bSetOpenBorders then
|
||||
SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId)
|
||||
end
|
||||
-- variabili per parametri lavorazione
|
||||
@@ -4327,7 +4358,41 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill)
|
||||
-- Trova il numero (0 based) della faccia meglio orientata come l'asse 'sAxis'. Restituisce anche vtN e ptC della faccia stessa.
|
||||
-- sAxis: 'X' o 'Y' o 'Z'
|
||||
local function FindFaceBestOrientedAsAxis( Proc, sAxis)
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
local nFaceMaximumNormalComponentOnAxis = 0
|
||||
local dFaceMaximumNormalComponentOnAxisValue = 0
|
||||
for i = 1, Proc.Fct do
|
||||
ptC[i], vtN[i] = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||
if sAxis == 'X' then
|
||||
if abs(vtN[i]:getX()) > dFaceMaximumNormalComponentOnAxisValue then
|
||||
nFaceMaximumNormalComponentOnAxis = i - 1
|
||||
dFaceMaximumNormalComponentOnAxisValue = abs(vtN[i]:getX())
|
||||
end
|
||||
elseif sAxis == 'Y' then
|
||||
if abs(vtN[i]:getY()) > dFaceMaximumNormalComponentOnAxisValue then
|
||||
nFaceMaximumNormalComponentOnAxis = i - 1
|
||||
dFaceMaximumNormalComponentOnAxisValue = abs(vtN[i]:getY())
|
||||
end
|
||||
elseif sAxis == 'Z' then
|
||||
if abs(vtN[i]:getZ()) > dFaceMaximumNormalComponentOnAxisValue then
|
||||
nFaceMaximumNormalComponentOnAxis = i - 1
|
||||
dFaceMaximumNormalComponentOnAxisValue = abs(vtN[i]:getZ())
|
||||
end
|
||||
else
|
||||
local sErr = 'Error : FindFaceBestOrientedAsAxis - unknown axis name'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
return nFaceMaximumNormalComponentOnAxis, vtN[ nFaceMaximumNormalComponentOnAxis + 1], ptC[ nFaceMaximumNormalComponentOnAxis + 1]
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap)
|
||||
local sWarn
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
@@ -4456,8 +4521,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
end
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT)
|
||||
-- imposto angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 1))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 1))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||
-- imposto offset radiale
|
||||
local dOffs = ( i - 1) * dStep
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||
@@ -4477,8 +4542,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, GetChainSawInitAngs( vtN, vtOrtho, 2))
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, ProcessLapJoint.GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, ProcessLapJoint.GetChainSawInitAngs( vtN, vtOrtho, 2))
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
@@ -4523,6 +4588,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
|
||||
-- verifico se due facce o L con una o due facce di terminazione
|
||||
local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2)
|
||||
-- se L30 e paramtetro Q03=2 forzo la fresatura di lato
|
||||
local bForceSideMill = Proc.Prc == 30 and EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 and ( Proc.Fct == 4 or Proc.Fct == 3 or Proc.Fct == 2)
|
||||
-- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia
|
||||
local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
|
||||
if bPrevBhSideMill == nil then
|
||||
@@ -4531,6 +4598,15 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
if bMakeBySideMill then
|
||||
-- se smusso non è esclusivo
|
||||
if nChamfer < 2 then
|
||||
-- verifico che la faccia non sia diretta come X, altrimenti cerco di cambiarla
|
||||
if abs( vtN:getX()) > 0.866 and nFacInd2 then
|
||||
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd2, GDB_ID.ROOT)
|
||||
if vtN2 and abs( vtN2:getX()) < 0.866 then
|
||||
nFacInd, nFacInd2 = nFacInd2, nFacInd
|
||||
dFacElev, dFacElev2 = dFacElev2, dFacElev
|
||||
vtN, vtN2 = vtN2, vtN
|
||||
end
|
||||
end
|
||||
-- se lavorazione da sotto e lunga, va divisa in due metà
|
||||
local bDouble = ( vtN:getZ() < -0.5 and dH > ( BD.MAX_LEN_BH_FROM_BOTTOM or 200))
|
||||
-- inserisco la lavorazione di fresatura
|
||||
@@ -4573,7 +4649,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG)
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + b3Raw:getDimY() + BD.CUT_SIC))
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, dFacElev + BD.COLL_SIC)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, EgtIf( vtN:getZ() > -0.5, dFacElev + BD.COLL_SIC, BD.COLL_SIC))
|
||||
if bDouble then
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, - dH / 2)
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, -( dToolDiam / 2 + dH / 2 + BD.CUT_SIC))
|
||||
@@ -4747,9 +4823,9 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
dFacElev, dFacElev2 = dFacElev2, dFacElev
|
||||
bUseOtherFace = true
|
||||
end
|
||||
-- verifico non sia orientata verso il basso o ci sia una testa dal basso
|
||||
-- verifico non sia orientata verso il basso o ci sia una testa dal basso o la lavorazione sia dal lato.
|
||||
local bFaceDown = ( vtN:getZ() < BD.NZ_MINA)
|
||||
if bFaceDown and not BD.DOWN_HEAD and not BD.TURN then
|
||||
if bFaceDown and not BD.DOWN_HEAD and not BD.TURN and not bForceSideMill then
|
||||
local sErr = 'Error : LapJoint from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
@@ -4799,14 +4875,16 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
-- settaggio voluto da Alessandro/Fabio (per fare angoli con fresa piccola)
|
||||
sMchFind = 'Pocket'
|
||||
local dDiam = min( dH, dV)
|
||||
local bTailOnSide = ( Proc.Box:getMin():getX() - b3Solid:getMin():getX() < 0.1 and not Proc.Tail)
|
||||
local bTailOnSide = ( Proc.Box:getMin():getX() - b3Solid:getMin():getX() < 0.1 and not Proc.Tail and not bAllWithEndCap)
|
||||
if ( Proc.Fct == 1) or (( Proc.Fct == 2 or Proc.Fct == 3) and bIsL) or ((( Proc.Fct == 3 and bIsU) or ( Proc.Fct == 4 and not bTailOnSide)) and bSinglePart) then
|
||||
sMchFind = 'OpenPocket'
|
||||
if bIsU then
|
||||
dDiam = GetUShapeWidth( Proc, nFacInd) or dDiam
|
||||
elseif Proc.Fct == 4 then
|
||||
-- per rifinire gli angoli premio utensile diam 25 o da BD
|
||||
dDiam = min( dDiam, BD.MAXDIAM_POCK_CORNER or 30)
|
||||
-- se non angoli fittizi, per rifinire gli angoli premio utensile diam 25 o da BD
|
||||
if not bAllWithEndCap then
|
||||
dDiam = min( dDiam, BD.MAXDIAM_POCK_CORNER or 30)
|
||||
end
|
||||
elseif Proc.Fct == 3 and bIsL then
|
||||
-- per rifinire gli angoli premio utensile diam 25 o da BD
|
||||
dDiam = min( 2 * dDiam, BD.MAXDIAM_POCK_CORNER or 30)
|
||||
@@ -4957,14 +5035,18 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
if Proc.Prc == 16 and bForceUseBlade and Proc.Fct == 3 and bIsU then
|
||||
sPocketing = nil
|
||||
end
|
||||
-- se richiesta fresatura di lato
|
||||
if bForceSideMill then
|
||||
sPocketing = nil
|
||||
end
|
||||
-- leggo parametro Q
|
||||
local nQAntisplintResult = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0
|
||||
-- se lavorazione fresa come lama disabilito eveentuale antischegggia
|
||||
-- se lavorazione fresa come lama disabilito eventuale antischeggia
|
||||
if bSpecialMillOnSide then nQAntisplintResult = 0 end
|
||||
-- se non trova una svuotatura adatta
|
||||
if not sPocketing then
|
||||
-- se forma a L provo con contornatura
|
||||
if bIsL and not bSpecialMillOnSide then
|
||||
if bIsL and not bSpecialMillOnSide and not bForceSideMill then
|
||||
-- se smusso non è esclusivo
|
||||
if nChamfer < 2 then
|
||||
return MakeByMill( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV, dFacElev, dCollSic)
|
||||
@@ -5076,60 +5158,98 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacInd, sWarn, bSawDown, true)
|
||||
if not bOk then return false, sWarn end
|
||||
end
|
||||
-- in base al flag interno e al numero di facce e se ha forma ad U: provo prima la svuotatura sul fianco e
|
||||
-- in base al flag interno e al numero di facce e se ha forma ad U
|
||||
-- oppure se richiesta lavorazione di lato:
|
||||
-- provo prima la svuotatura sul fianco e
|
||||
-- se non è possibile allora provo in seguito con lama o segacatena
|
||||
-- o passare subito dalla lavorazione con lama/sega catena
|
||||
if bTrySidePocketAtFirst and Proc.Fct == 3 and bIsU then
|
||||
if ( bTrySidePocketAtFirst and Proc.Fct == 3 and bIsU) or bForceSideMill then
|
||||
-- lavoro con svuotature (singola o doppia contrapposta)
|
||||
local sMyMchFind = 'Pocket'
|
||||
local dDiamTool = 100
|
||||
local nPathInt, nSurfInt, bOneShot, nFirstMachId
|
||||
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId,
|
||||
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, true, b3Solid, nil, bMillDown)
|
||||
if nOk == -2 then
|
||||
if not sMchFind then
|
||||
sMchFind = sMchFindBackUp
|
||||
end
|
||||
sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown)
|
||||
if not sPocketing then
|
||||
local sErr2 = 'Error : '..sMchFind..' not found in library'
|
||||
EgtOutLog( sErr2)
|
||||
return false, sErr2
|
||||
local bIs3Faces = true
|
||||
local bOrthoFacesMaster = nil
|
||||
local bSetOpenBorders = nil
|
||||
-- trovo la faccia con normale più inclinata verso Y
|
||||
local nFacApproxY, vtNFacApproxY, ptCFacApproxY = FindFaceBestOrientedAsAxis( Proc, 'Y')
|
||||
-- se Q03 = 2 e
|
||||
-- 3 facce a L, oppure
|
||||
-- 3 facce non a L ma con una faccia favorevole a Y, oppure
|
||||
-- 4 facce
|
||||
-- lancio la MakePocket ( lavorazione solo da un lato, fondo della tasca la faccia più favorevole a Y)
|
||||
if bForceSideMill and (( Proc.Fct == 3 and bIsL) or ( Proc.Fct == 3 and abs( vtNFacApproxY:getY()) >= 0.707 ) or Proc.Fct == 4) then
|
||||
nFacInd, vtN, ptC = nFacApproxY, vtNFacApproxY, ptCFacApproxY
|
||||
local tvtNx = {}
|
||||
tvtNx[2] = vtN
|
||||
local ptPs = ptC
|
||||
dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd)
|
||||
dCollSic = CalcCollisionSafety( tvtNx[2])
|
||||
local dMachDepth = dFacElev + dCollSic
|
||||
local _, _, dDimMin = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local _, sPocketing = VerifyPocket( Proc, dDimMin, dFacElev, nil, sMyMchFind)
|
||||
bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap)
|
||||
if not bOk then return false, sWarn2 end
|
||||
if sWarn2 then
|
||||
if not sWarn then sWarn = '' end
|
||||
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
||||
end
|
||||
bTryWithBlades = false
|
||||
sWarn = sErr
|
||||
elseif nOk < 0 then
|
||||
return false, sErr
|
||||
elseif nOk > 0 then
|
||||
bTryWithBlades = false
|
||||
sWarn = sErr
|
||||
-- se ho antischeggia con fresa le inserisco
|
||||
-- if nChamfer < 2 and nQAntisplintResult == 2 and ( bIsU or bIsL) then
|
||||
if nChamfer < 2 and nQAntisplintResult == 2 then
|
||||
local bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
nFacInd, nAddGrpId, bMillDown, dDiamTool, bDoubleSide,
|
||||
vtOrtho, nPathInt, nSurfInt, b3Solid, dDepth,
|
||||
bOneShot, nFirstMachId)
|
||||
if sWarn2 then
|
||||
if not sWarn then sWarn = '' end
|
||||
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
||||
end
|
||||
end
|
||||
-- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola
|
||||
local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0
|
||||
if nContourSmallTool > 0 then
|
||||
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bMillDown,
|
||||
bDoubleSide, vtOrtho, nPathInt, nSurfInt, b3Solid,
|
||||
dDepth, bOneShotm)
|
||||
if not bOk then return false, sWarn2 end
|
||||
if sWarn2 then
|
||||
if not sWarn then sWarn = '' end
|
||||
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
||||
-- in tutti gli altri casi lancio la MakeByPockets (lavorazione singola o doppia contrapposta, fondo della tasca una faccia fittizia perpendicolare al lato lungo)
|
||||
else
|
||||
-- se 2 facce setto i parametri corretti per la MakeByPockets
|
||||
if bForceSideMill and Proc.Fct == 2 then
|
||||
bIs3Faces = false
|
||||
bOrthoFacesMaster = true
|
||||
bSetOpenBorders = true
|
||||
end
|
||||
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId,
|
||||
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders)
|
||||
if nOk == -2 then
|
||||
if not sMchFind then
|
||||
sMchFind = sMchFindBackUp
|
||||
end
|
||||
sPocketing = ML.FindPocketing( sMchFind, dDiam, nil, nil, not bMillDown, bMillDown)
|
||||
if not sPocketing then
|
||||
local sErr2 = 'Error : '..sMchFind..' not found in library'
|
||||
EgtOutLog( sErr2)
|
||||
return false, sErr2
|
||||
end
|
||||
bTryWithBlades = false
|
||||
sWarn = sErr
|
||||
elseif nOk < 0 then
|
||||
return false, sErr
|
||||
elseif nOk > 0 then
|
||||
bTryWithBlades = false
|
||||
sWarn = sErr
|
||||
-- se ho antischeggia con fresa le inserisco
|
||||
-- if nChamfer < 2 and nQAntisplintResult == 2 and ( bIsU or bIsL) then
|
||||
if nChamfer < 2 and nQAntisplintResult == 2 then
|
||||
local bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
nFacInd, nAddGrpId, bMillDown, dDiamTool, bDoubleSide,
|
||||
vtOrtho, nPathInt, nSurfInt, b3Solid, dDepth,
|
||||
bOneShot, nFirstMachId)
|
||||
if sWarn2 then
|
||||
if not sWarn then sWarn = '' end
|
||||
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
||||
end
|
||||
end
|
||||
-- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola
|
||||
local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0
|
||||
if nContourSmallTool > 0 then
|
||||
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bMillDown,
|
||||
bDoubleSide, vtOrtho, nPathInt, nSurfInt, b3Solid,
|
||||
dDepth, bOneShotm)
|
||||
if not bOk then return false, sWarn2 end
|
||||
if sWarn2 then
|
||||
if not sWarn then sWarn = '' end
|
||||
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
||||
end
|
||||
end
|
||||
end
|
||||
bOk = true
|
||||
end
|
||||
bOk = true
|
||||
end
|
||||
-- 03/09/2020 da conferma di Fabio Squaratti: Per ora solo sulla feature 016:
|
||||
-- se ha fallito la fresatura (qua sopra) allora di defalut ( anche se il flag Q della lama è disattivato) prima provo la lama
|
||||
@@ -5221,7 +5341,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
local tvtNx = {}
|
||||
tvtNx[2] = vtN
|
||||
local bOk, sWarn2
|
||||
bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptC, tvtNx, nFacInd, sMchFind, nUseRoughTool, sPocketing, dFacElev + dCollSic)
|
||||
bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptC, tvtNx, nFacInd, sMchFind, nUseRoughTool, sPocketing, dFacElev + dCollSic, nil, nil, bAllWithEndCap)
|
||||
if not bOk then return false, sWarn2 end
|
||||
if sWarn2 then
|
||||
if not sWarn then sWarn = '' end
|
||||
@@ -5298,6 +5418,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
end
|
||||
end
|
||||
end
|
||||
-- eventuale segnalazione ingombro di testa o coda
|
||||
UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
|
||||
end
|
||||
|
||||
return true, sWarn, bPrevBhSideMill
|
||||
@@ -5314,8 +5436,34 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
|
||||
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID
|
||||
-- verifico se applicare gestione speciale delle giunzioni (U diretta come asse X)
|
||||
local bAddEndCap = false
|
||||
local dAddLen = 0
|
||||
local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
|
||||
if bIsU then
|
||||
local ptC0, vtN0 = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
local ptC1, vtN1 = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT)
|
||||
local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, 2, GDB_ID.ROOT)
|
||||
if vtN0:getX() < 0.0175 and vtN1:getX() < 0.0175 and vtN2:getX() < 0.0175 then
|
||||
local dWidth = 0
|
||||
if vtN0 * vtN1 < -0.9998 then
|
||||
bAddEndCap = true
|
||||
dWidth = ( ptC1 - ptC0) * vtN0
|
||||
elseif vtN0 * vtN2 < -0.9998 then
|
||||
bAddEndCap = true
|
||||
dWidth = ( ptC2 - ptC0) * vtN0
|
||||
elseif vtN1 * vtN2 < -0.9998 then
|
||||
bAddEndCap = true
|
||||
dWidth = ( ptC2 - ptC1) * vtN1
|
||||
end
|
||||
dAddLen = min( dWidth, 100) / 2
|
||||
end
|
||||
end
|
||||
-- la divido in parti lungo X
|
||||
local vAddId = {}
|
||||
local bAllWithEndCap = bAddEndCap
|
||||
local nPart = max( ceil( Proc.Box:getDimX() / BD.LONGCUT_MAXLEN), 2)
|
||||
local dPartLen = Proc.Box:getDimX() / nPart
|
||||
local Xmin = Proc.Box:getMin():getX()
|
||||
@@ -5323,13 +5471,43 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- eseguo divisione
|
||||
local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
||||
EgtSetName( AddId, 'AddPart_' .. tostring( Proc.Id) .. '_' .. tostring( i))
|
||||
if i > 1 then
|
||||
local ptOn = Point3d( Xmin + ( i - 1) * dPartLen, 0, 0)
|
||||
EgtCutSurfTmPlane( AddId, ptOn, -X_AX(), true, GDB_RT.GLOB)
|
||||
if i > 1 or bAddEndCap then
|
||||
-- definizione del piano
|
||||
local dAdd = EgtIf( i > 1, dAddLen, 0)
|
||||
local ptOn = Point3d( Xmin - dAdd + ( i - 1) * dPartLen, 0, 0)
|
||||
local vtN = -X_AX()
|
||||
-- se richiesto, creazione tappo
|
||||
local CapId
|
||||
if bAddEndCap then
|
||||
local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOn, vtN, AddId, nAddGrpId, GDB_RT.GLOB)
|
||||
if nPnt == 0 and nCrv == 1 and nSrf == 0 then
|
||||
EgtCloseCurveCompo( nFirstId)
|
||||
CapId = EgtSurfTmByFlatContour( nAddGrpId, nFirstId)
|
||||
if not CapId then bAllWithEndCap = false end
|
||||
end
|
||||
if nFirstId then
|
||||
for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do
|
||||
EgtErase( nId)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- taglio della superficie
|
||||
EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB)
|
||||
-- se esiste, aggiunta del tappo
|
||||
if CapId then
|
||||
AddId = EgtSurfTmBySewing( nAddGrpId, { AddId, CapId})
|
||||
-- se prima spezzatura, allungamento per non lasciare archi
|
||||
if i == 1 then
|
||||
local b3Box = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD)
|
||||
local dCoeffX = 1 + min( dAddLen, dDistToNextPiece) / b3Box:getDimX()
|
||||
EgtScale( AddId, Frame3d( b3Box:getMax()), dCoeffX, 1, 1, GDB_RT.GLOB)
|
||||
end
|
||||
end
|
||||
end
|
||||
if i < nPart then
|
||||
local ptOn = Point3d( Xmin + i * dPartLen, 0, 0)
|
||||
EgtCutSurfTmPlane( AddId, ptOn, X_AX(), true, GDB_RT.GLOB)
|
||||
local vtN = X_AX()
|
||||
EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB)
|
||||
end
|
||||
-- eseguo inserimento in modo da ordinare da X+ a X-
|
||||
table.insert( vAddId, 1, AddId)
|
||||
@@ -5343,7 +5521,7 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, TotBox = Proc.Box, Fct = nFct, Flg = Proc.Flg}
|
||||
-- lasciare il false nel sesto parametro (perchè internamente viene verificato se diverso da nil)
|
||||
local bOk, sMyWarn
|
||||
bOk, sMyWarn, bPrevBhSideMill = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId, dOvmHead, false, bPrevBhSideMill)
|
||||
bOk, sMyWarn, bPrevBhSideMill = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId, dOvmHead, bAllWithEndCap, bPrevBhSideMill, bAllWithEndCap)
|
||||
if not sWarn then sWarn = sMyWarn end
|
||||
if not bOk then return bOk, sWarn end
|
||||
end
|
||||
@@ -5396,7 +5574,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local nUseRoughToolOnSide = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0
|
||||
nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, Q_BLADE_ON_ALONG_FACE, 'i') or 0
|
||||
-- se antischeggia di fresa o abilitato sgrossatore di fianco
|
||||
if nBladeAntisplint == 2 or nUseRoughToolOnSide == 1 then
|
||||
if nBladeAntisplint == 2 or nUseRoughToolOnSide > 0 then
|
||||
bUseBlade = false
|
||||
end
|
||||
-- se ho attivo la lama e ho la feature 32, verifico i parametri Q propri della feature
|
||||
@@ -5434,15 +5612,20 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
elseif Proc.Fct == 2 then
|
||||
-- verifico se da lavorare con testa da sotto
|
||||
local bDownHead = TestTwoFacesDownHead( Proc)
|
||||
-- determino se due facce lunghe oppure una lunga e l'altra terminale
|
||||
-- dati delle facce
|
||||
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 0, GDB_BB.STANDARD)
|
||||
local b3Fac2 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 1, GDB_BB.STANDARD)
|
||||
if abs( b3Fac1:getDimX() - b3Fac2:getDimX()) < 50 and abs( b3Fac1:getCenter():getX() - b3Fac2:getCenter():getX()) < 50 then
|
||||
local vtN1 = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT)
|
||||
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT)
|
||||
-- determino se due facce lunghe oppure una lunga e l'altra terminale
|
||||
if abs( b3Fac1:getDimX() - b3Fac2:getDimX()) < 50 and abs( b3Fac1:getCenter():getX() - b3Fac2:getCenter():getX()) < 50 and
|
||||
abs( vtN1:getX()) < GEO.EPS_SMALL and abs( vtN2:getX()) < GEO.EPS_SMALL then
|
||||
-- leggo i parametri Q per utilizzare la fresa di fianco e/o lama
|
||||
local nUseSideTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0
|
||||
local bUseBlade = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') == 1
|
||||
return Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool)
|
||||
elseif b3Fac1:getDimX() < 1 then
|
||||
-- prima faccia terminale
|
||||
elseif b3Fac1:getDimX() < 1 and abs( vtN2:getX()) < GEO.EPS_SMALL then
|
||||
-- la faccia 0 deve essere quella lunga
|
||||
EgtSurfTmSwapFacets( Proc.Id, 0, 1)
|
||||
if bUseBlade then
|
||||
@@ -5454,7 +5637,8 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
else
|
||||
return LongCut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
elseif b3Fac2:getDimX() < 1 then
|
||||
-- seconda faccia terminale
|
||||
elseif b3Fac2:getDimX() < 1 and abs( vtN1:getX()) < GEO.EPS_SMALL then
|
||||
if bUseBlade then
|
||||
if nForceUseBladeOnNotContinueFace and nForceUseBladeOnNotContinueFace > 0 then
|
||||
return LongCut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nForceUseBladeOnNotContinueFace)
|
||||
@@ -5464,8 +5648,9 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
else
|
||||
return LongCut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
-- altrimenti
|
||||
else
|
||||
if bUseBlade then
|
||||
if bUseBlade and ( abs( vtN1:getX()) > 0.5 or abs( vtN2:getX()) > 0.5) then
|
||||
return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead)
|
||||
else
|
||||
return MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
@@ -5557,7 +5742,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- se smusso non esclusivo
|
||||
if nChamfer < 2 then
|
||||
return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead)
|
||||
return Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, 'HeadSide' .. EgtIf( bDownHead, '_H2', ''), true, bDownHead or BD.TURN)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/03/20
|
||||
-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/05/27
|
||||
-- Gestione calcolo doppio taglio longitudinale per Travi
|
||||
-- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto.
|
||||
-- 2021/06/29 Corretta gestione caso equivalente a due smussi.
|
||||
@@ -7,6 +7,7 @@
|
||||
-- 2022/02/08 Sistemate lunghezze fresature quando due sole.
|
||||
-- 2022/02/15 Sistemati commenti.
|
||||
-- 2022/03/20 Tolta da scelta milling tipo Long2CutDown controllo max diametro fresa.
|
||||
-- 2022/05/27 Corretto ordine per casi sui lati.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessLong2Cut = {}
|
||||
@@ -254,7 +255,7 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex,
|
||||
end
|
||||
end
|
||||
else
|
||||
if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) or ( vtN2 and vtN2:getZ() >= -0.5) then
|
||||
if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) and ( not vtN2 or vtN2:getZ() >= -0.5) then
|
||||
bCanUseBlade = true
|
||||
end
|
||||
end
|
||||
@@ -294,9 +295,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
|
||||
-- verifico posizione (+1=sopra, -1=sotto, 0=sui lati)
|
||||
local nSide = 0
|
||||
if vtN[1]:getZ() > -10 * GEO.EPS_SMALL and vtN[2]:getZ() > -10 * GEO.EPS_SMALL then
|
||||
if vtN[1]:getZ() > 0.0175 and vtN[2]:getZ() > 0.0175 then
|
||||
nSide = 1
|
||||
elseif vtN[1]:getZ() < 10 * GEO.EPS_SMALL and vtN[2]:getZ() < 10 * GEO.EPS_SMALL then
|
||||
elseif vtN[1]:getZ() < -0.0175 and vtN[2]:getZ() < -0.0175 then
|
||||
nSide = -1
|
||||
end
|
||||
|
||||
@@ -305,39 +306,21 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
local bConvex
|
||||
local bOrtho
|
||||
local ptM
|
||||
local ptRef = ( ptC[1] + ptC[2]) / 2
|
||||
if bInt then
|
||||
bConvex = ( dAng >= 0)
|
||||
bOrtho = ( abs( dAng + 90) < 1)
|
||||
ptM = ( ptP1 + ptP2) / 2
|
||||
else
|
||||
bConvex = true
|
||||
ptM = ptRef
|
||||
local vtM1 = ptC[1] - ptM ; vtM1:normalize()
|
||||
local vtM2 = ptC[2] - ptM ; vtM2:normalize()
|
||||
bConvex = ( vtM1 * vtN[1] > 0 and vtM2 * vtN[2] > 0)
|
||||
bOrtho = false
|
||||
dAng = acos( vtN[1] * vtN[2])
|
||||
ptM = ( ptC[1] + ptC[2]) / 2
|
||||
-- se facce contrapposte e quindi concavo, angolo sempre negativo
|
||||
if not bConvex and dAng > 0 then dAng = -dAng end
|
||||
end
|
||||
local ptRef = ( ptC[1] + ptC[2]) / 2
|
||||
-- analisi del taglio
|
||||
local vOrd = {}
|
||||
local vFaceUse = {}
|
||||
if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then
|
||||
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
|
||||
elseif nSide == -1 then
|
||||
vOrd = EgtIf( ptC[1]:getY() < ptM:getY(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
|
||||
else
|
||||
local bFront = ( vtN[1]:getY() < 0)
|
||||
if bFront then
|
||||
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
|
||||
else
|
||||
vOrd = EgtIf( ptC[1]:getZ() < ptM:getZ(), { 2, 1}, { 1, 2})
|
||||
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
|
||||
end
|
||||
end
|
||||
local vWidth = {}
|
||||
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
|
||||
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
|
||||
|
||||
-- ottengo la distanza tra la fine del pezzo e il pezzo successivo
|
||||
local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or 5.4
|
||||
@@ -380,6 +363,29 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
-- analisi del taglio
|
||||
local vOrd = {}
|
||||
local vFaceUse = {}
|
||||
if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then
|
||||
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
|
||||
elseif nSide == -1 then
|
||||
vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)}
|
||||
else
|
||||
local bFront = ( vtN[1]:getY() < 0 or vtN[2]:getY() < 0)
|
||||
if bFront then
|
||||
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1})
|
||||
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
|
||||
else
|
||||
vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 2, 1}, { 1, 2})
|
||||
vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)}
|
||||
end
|
||||
end
|
||||
local vWidth = {}
|
||||
_, _, vWidth[1] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[1])
|
||||
_, _, vWidth[2] = BL.GetFaceHvRefDim( Proc.Id, tFaceLong[2])
|
||||
|
||||
-- Se senza facce limitanti, da sopra o ( da tutte i lati con testa da sotto) e taglio di lama e lunghezza facce maggiore del parametro lunghezza minima
|
||||
if nFaceLimit == 0 and ( bCanUseUnderBlade or bCanUseBlade) and bUseBlade and Proc.Box:getDimX() > dLimMinPiece - 1 then
|
||||
|
||||
@@ -755,7 +761,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
-- se faccia da sotto e Z centro faccia è minore del centro altra faccia, segno il limite angolare da passare
|
||||
-- dovrebbe essere il limite angolare della testa 1 in sottosquadra
|
||||
if nSide == -1 and not BD.DOWN_HEAD then
|
||||
if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() then
|
||||
if ptC[vOrd[j]]:getZ() < ptC[vOrd[OthFace]]:getZ() - 1. then
|
||||
dSinLimit = -0.0157
|
||||
else
|
||||
dSinLimit = -0.5
|
||||
@@ -855,7 +861,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
|
||||
-- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut
|
||||
elseif ( ( nSide ~= -1 or BD.DOWN_HEAD) or ( nSide == -1 and BD.DOWN_HEAD)) and nUseMillOnSide == 0 then
|
||||
elseif ( nSide ~= -1 or BD.DOWN_HEAD or BD.TURN) and nUseMillOnSide == 0 then
|
||||
-- determino la massima elevazione
|
||||
local dElev = 0
|
||||
local dFacElev1 = BL.GetFaceElevation( Proc.Id, tFaceLong[1], nPartId)
|
||||
@@ -893,10 +899,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- se la fine (a sinistra) non è limitata e ho un pezzo successivo più distante da metà raggio. setto la fine come limitata
|
||||
if dDistToNextPiece < dToolDiam/2 and nFaceLimit < 2 then
|
||||
-- se ho un pezzo successivo più distante di metà raggio : setto la fine come limitata
|
||||
if dDistToNextPiece < dToolDiam/2 then
|
||||
bForcedLim = true
|
||||
nFaceLimit = nFaceLimit + 2
|
||||
nFaceLimit = nFaceLimit | 2
|
||||
end
|
||||
-- se chiuso e corto, applico svuotatura con fresa opportuna
|
||||
if nFaceLimit == 3 and Proc.Box:getDimX() < 2 * dToolDiam then
|
||||
@@ -1017,6 +1023,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
end
|
||||
end
|
||||
end
|
||||
if nIni == 2 then
|
||||
dStartDist, dEndDist = dEndDist, dStartDist
|
||||
dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist
|
||||
end
|
||||
-- ciclo sulle parti
|
||||
local nM = 0
|
||||
for j = 1, nC do
|
||||
@@ -1025,7 +1035,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
-- valore sovrapposizione tra passate con fresa di fianco
|
||||
local dOverLapExtend = 2
|
||||
-- Verifico se da fare di fianco perchè normale troppo verso il basso (minore di -30deg)
|
||||
local bSide = ( vtN[vOrd[i]]:getZ() < dLimitAngle and not ( nSide == -1 and BD.DOWN_HEAD))
|
||||
local bSide = ( vtN[vOrd[i]]:getZ() < dLimitAngle and not ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)))
|
||||
-- Limitazioni della lavorazione
|
||||
local nPos = EgtIf( i == 1, j, nC - j + 1)
|
||||
local dSal = EgtIf( nPos == 1, - EgtIf( i == nIni, dStartDist, dEndDist), - EgtIf( i == nIni, dStartAccDist, dEndAccDist) - ( nPos - 2) * dC + EgtIf( bSide, dOverLapExtend, 0))
|
||||
@@ -1033,7 +1043,17 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster
|
||||
-- Posizione braccio portatesta
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM then
|
||||
nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
if not BD.TURN then
|
||||
nSCC = EgtIf( ( j == 1 or j == nC - 1), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
else
|
||||
if nSide == 1 then
|
||||
nSCC = EgtIf( vtN[vOrd[i]]:getY() < -0.5, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
||||
elseif nSide == -1 then
|
||||
nSCC = EgtIf( vtN[vOrd[i]]:getY() < 0, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
||||
else
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
end
|
||||
end
|
||||
end
|
||||
if bSide and not bConvex then
|
||||
dSal, dEal = dEal, dSal
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessMark.lua by Egaltech s.r.l. 2021/05/03
|
||||
-- ProcessMark.lua by Egaltech s.r.l. 2022/06/07
|
||||
-- Gestione calcolo marcatura per Travi
|
||||
-- 2020/05/28 Tipo di lavorazione passato da Mark a Text.
|
||||
-- 2021/05/03 Aggiunta gestione testa da sotto.
|
||||
@@ -60,7 +60,7 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
|
||||
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD then
|
||||
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
|
||||
@@ -198,7 +198,7 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
+149
-90
@@ -1,4 +1,4 @@
|
||||
-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/02/02
|
||||
-- ProcessProfCamb.lua by Egaltech s.r.l. 2022/05/28
|
||||
-- Gestione calcolo profilo caudato per Travi
|
||||
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
|
||||
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
||||
@@ -6,6 +6,8 @@
|
||||
-- 2021/10/12 Portato a 30deg l'angolo limite per fare l'antischeggia.
|
||||
-- 2022/01/26 Migliorato controllo lavorazione con fresa su testa da sotto.
|
||||
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProfCamb = {}
|
||||
@@ -14,6 +16,7 @@ local ProcessProfCamb = {}
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
local Fbp = require( 'FaceByPocket')
|
||||
local Cut = require( 'ProcessCut')
|
||||
|
||||
EgtOutLog( ' ProcessProfCamb started', 1)
|
||||
@@ -204,6 +207,7 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local sWarn
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -275,19 +279,38 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
bMakeAs = true
|
||||
end
|
||||
end
|
||||
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
|
||||
-- se smusso non è esclusivo, aggiungo sgrossatura
|
||||
if nChamfer < 2 then
|
||||
-- aggiungo taglio di lama di sgrossatura e lo lavoro
|
||||
-- aggiungo piano di sgrossatura e lo lavoro
|
||||
local ptStart, vtNP = GetSawCutData( AuxId, vtNF)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- applico la lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
|
||||
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
|
||||
-- recupero la lavorazione
|
||||
local sPockType = 'OpenPocket'
|
||||
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
|
||||
if not sPocketing then
|
||||
local sErr = 'Error : pocketing '..sPockType..' not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- eseguo le svuotature necessarie
|
||||
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
-- leggo anticipatamente i parametri utensile fresa per dare un valore opportuno all'elevazione della lama
|
||||
-- recupero la lavorazione di fresatura
|
||||
@@ -443,9 +466,124 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- se il chamfer non è esclusivo continuo con le altre lavorazioni
|
||||
if nChamfer < 2 then
|
||||
-- verifico se necessario lavorare in doppio
|
||||
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||
-- inserisco la lavorazione
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
local sMillingDown
|
||||
if bDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
|
||||
if not sMillingDown then
|
||||
sWarn = 'Warning : milling from bottom not found in library'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
else
|
||||
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se orizzontale o trovata lavorazione per doppio verticale
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName
|
||||
if bMakeAs then
|
||||
sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
else
|
||||
sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
end
|
||||
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- se lavorazione da sopra e da sotto
|
||||
if ( nSide == 0) then
|
||||
if vtExtr:getZ() > 0.1 then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
-- altrimenti lavorazione davanti e dietro
|
||||
else
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
bFinish = true
|
||||
end
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione
|
||||
ModifySideAndInvert( Proc, bHead)
|
||||
end
|
||||
-- se devo fare l'antischeggia in testa
|
||||
if bMakeAs then
|
||||
local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
-- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale)
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
-- rendo corrente la precedente, la inverto e modifico il parametri di uscita
|
||||
EgtSetCurrMachining( nMchId)
|
||||
local dCrvLen = EgtCurveLength( AuxId)
|
||||
if dCrvLen > abs(dMakeAntiSplintOnHead) then
|
||||
ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen))
|
||||
end
|
||||
-- rendo corrente la copia (cioè la lavorazione completa)
|
||||
EgtSetCurrMachining( nMch2Id)
|
||||
nMchId = nMch2Id
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- inserisco la prima lavorazione
|
||||
local sName
|
||||
if bMakeAs then
|
||||
sName = 'Prof_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
@@ -553,85 +691,6 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName
|
||||
if bMakeAs then
|
||||
sName = 'ProfB_As_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
else
|
||||
sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
end
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- sempre lavorazione da sopra o da sotto
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione
|
||||
ModifySideAndInvert( Proc, bHead)
|
||||
end
|
||||
-- se devo fare l'antischeggia in testa
|
||||
if bMakeAs then
|
||||
local sNewName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
-- copio lavorazione per ingresso antischeggia (la copia è la lavorazione finale)
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
-- rendo corrente la precedente, la inverto e modifico il parametri di uscita
|
||||
EgtSetCurrMachining( nMchId)
|
||||
local dCrvLen = EgtCurveLength( AuxId)
|
||||
if dCrvLen > abs(dMakeAntiSplintOnHead) then
|
||||
ModifySideAndInvert( Proc, bHead, true, ( abs(dMakeAntiSplintOnHead) - dCrvLen))
|
||||
end
|
||||
-- rendo corrente la copia (cioè la lavorazione completa)
|
||||
EgtSetCurrMachining( nMch2Id)
|
||||
nMchId = nMch2Id
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se non da sotto e parametro Q abilitato, inserisco lavorazione finitura angolo
|
||||
if ( nSide ~= -1 or bMillDown) and EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') == 1 then
|
||||
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
@@ -684,7 +743,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
|
||||
end
|
||||
end
|
||||
return true
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
+139
-80
@@ -1,8 +1,10 @@
|
||||
-- ProcessProfConcave.lua by Egaltech s.r.l. 2022/02/02
|
||||
-- ProcessProfConcave.lua by Egaltech s.r.l. 2022/05/28
|
||||
-- Gestione calcolo profilo concavo per Travi
|
||||
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
|
||||
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
||||
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProfConcave = {}
|
||||
@@ -10,6 +12,7 @@ local ProcessProfConcave = {}
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Fbp = require( 'FaceByPocket')
|
||||
local Cut = require( 'ProcessCut')
|
||||
|
||||
EgtOutLog( ' ProcessProfConcave started', 1)
|
||||
@@ -89,8 +92,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
||||
|
||||
-- confronto il punto iniziale e finale della lavorazione con il box della feature
|
||||
-- e se è vicino alla parte esterna della trave inverto la lavorazione
|
||||
ptSP = EgtGetMachiningStartPoint()
|
||||
ptEp = EgtGetMachiningEndPoint()
|
||||
local ptSP = EgtGetMachiningStartPoint()
|
||||
local ptEp = EgtGetMachiningEndPoint()
|
||||
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
|
||||
if nMachMode == 1 and ptSP and ptEp then
|
||||
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
|
||||
@@ -195,6 +198,7 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local sWarn
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -256,19 +260,38 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if nChamfer < 0 then
|
||||
return false, sChamfer
|
||||
end
|
||||
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
|
||||
-- se smusso non è esclusivo, aggiungo sgrossatura
|
||||
if nChamfer < 2 then
|
||||
-- aggiungo taglio di lama di sgrossatura e lo lavoro
|
||||
-- aggiungo piano di sgrossatura e lo lavoro
|
||||
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- applico la lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
|
||||
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
|
||||
-- recupero la lavorazione
|
||||
local sPockType = 'OpenPocket'
|
||||
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
|
||||
if not sPocketing then
|
||||
local sErr = 'Error : pocketing '..sPockType..' not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- eseguo le svuotature necessarie
|
||||
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se devo inserire il chamfer
|
||||
@@ -411,9 +434,109 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
-- verifico se necessario lavorare in doppio
|
||||
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||
-- inserisco la lavorazione
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
local sMillingDown
|
||||
if bDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
|
||||
if not sMillingDown then
|
||||
sWarn = 'Warning : milling from bottom not found in library'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
else
|
||||
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se orizzontale o trovata lavorazione per doppio verticale
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- resetto il flag inversione percorso
|
||||
bFlagInvert = false
|
||||
-- se lavorazione da sopra e da sotto
|
||||
if ( nSide == 0) then
|
||||
if vtExtr:getZ() > 0.1 then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = true
|
||||
end
|
||||
-- altrimenti lavorazione davanti e dietro
|
||||
else
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = true
|
||||
end
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
bFinish = true
|
||||
end
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||
-- e uscita
|
||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- inserisco la prima lavorazione
|
||||
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchId then
|
||||
@@ -467,7 +590,6 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local ptSP, ptEp
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
|
||||
@@ -491,7 +613,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
@@ -508,73 +630,10 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- resetto il flag inversione percorso
|
||||
bFlagInvert = false
|
||||
-- sempre lavorazione da sopra o da sotto
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||
-- e uscita
|
||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
|
||||
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
|
||||
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and
|
||||
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
|
||||
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then
|
||||
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchVId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchVId then
|
||||
@@ -610,7 +669,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
|
||||
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
|
||||
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
|
||||
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
|
||||
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then
|
||||
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchV2Id = EgtAddMachining( sName, sMilling)
|
||||
if not nMchV2Id then
|
||||
@@ -656,7 +715,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
|
||||
end
|
||||
end
|
||||
return true
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
+138
-79
@@ -1,8 +1,10 @@
|
||||
-- ProcessProfConvex.lua by Egaltech s.r.l. 2022/02/02
|
||||
-- ProcessProfConvex.lua by Egaltech s.r.l. 2022/05/28
|
||||
-- Gestione calcolo profilo convesso per Travi
|
||||
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
|
||||
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
||||
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProfConvex = {}
|
||||
@@ -10,6 +12,7 @@ local ProcessProfConvex = {}
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Fbp = require( 'FaceByPocket')
|
||||
local Cut = require( 'ProcessCut')
|
||||
|
||||
EgtOutLog( ' ProcessProfConvex started', 1)
|
||||
@@ -89,8 +92,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
||||
|
||||
-- confronto il punto iniziale e finale della lavorazione con il box della feature
|
||||
-- e se è vicino alla parte esterna della trave inverto la lavorazione
|
||||
ptSP = EgtGetMachiningStartPoint()
|
||||
ptEp = EgtGetMachiningEndPoint()
|
||||
local ptSP = EgtGetMachiningStartPoint()
|
||||
local ptEp = EgtGetMachiningEndPoint()
|
||||
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
|
||||
if nMachMode == 1 and ptSP and ptEp then
|
||||
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
|
||||
@@ -195,6 +198,7 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local sWarn
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -256,19 +260,38 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if nChamfer < 0 then
|
||||
return false, sChamfer
|
||||
end
|
||||
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
|
||||
-- se smusso non è esclusivo, aggiungo sgrossatura
|
||||
if nChamfer < 2 then
|
||||
-- aggiungo taglio di lama di sgrossatura e lo lavoro
|
||||
-- aggiungo piano di sgrossatura e lo lavoro
|
||||
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- applico la lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
|
||||
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
|
||||
-- recupero la lavorazione
|
||||
local sPockType = 'OpenPocket'
|
||||
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
|
||||
if not sPocketing then
|
||||
local sErr = 'Error : pocketing '..sPockType..' not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- eseguo le svuotature necessarie
|
||||
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se devo inserire il chamfer
|
||||
@@ -411,9 +434,109 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
-- verifico se necessario lavorare in doppio
|
||||
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||
-- inserisco la lavorazione
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
local sMillingDown
|
||||
if bDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
|
||||
if not sMillingDown then
|
||||
sWarn = 'Warning : milling from bottom not found in library'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
else
|
||||
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se orizzontale o trovata lavorazione per doppio verticale
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- resetto il flag inversione percorso
|
||||
bFlagInvert = false
|
||||
-- se lavorazione da sopra e da sotto
|
||||
if ( nSide == 0) then
|
||||
if vtExtr:getZ() > 0.1 then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = true
|
||||
end
|
||||
-- altrimenti lavorazione davanti e dietro
|
||||
else
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = true
|
||||
end
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
bFinish = true
|
||||
end
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||
-- e uscita
|
||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- inserisco la prima lavorazione
|
||||
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchId then
|
||||
@@ -467,7 +590,6 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local ptSP, ptEp
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
|
||||
@@ -508,73 +630,10 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- resetto il flag inversione percorso
|
||||
bFlagInvert = false
|
||||
-- sempre lavorazione da sopra o da sotto
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||
-- e uscita
|
||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst, bFirstTrim, bLastTrim, bFlagInvert, dOffsetPar)
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
|
||||
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
|
||||
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bLastTrim and
|
||||
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
|
||||
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then
|
||||
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchVId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchVId then
|
||||
@@ -610,7 +669,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
|
||||
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
|
||||
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
|
||||
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
|
||||
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then
|
||||
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchV2Id = EgtAddMachining( sName, sMilling)
|
||||
if not nMchV2Id then
|
||||
@@ -655,7 +714,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
|
||||
end
|
||||
end
|
||||
return true
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
+133
-73
@@ -1,8 +1,10 @@
|
||||
-- ProcessProfFront.lua by Egaltech s.r.l. 2022/02/02
|
||||
-- ProcessProfFront.lua by Egaltech s.r.l. 2022/05/28
|
||||
-- Gestione calcolo profilo frontale per Travi
|
||||
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa da sotto.
|
||||
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
||||
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProfFront = {}
|
||||
@@ -10,6 +12,7 @@ local ProcessProfFront = {}
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Fbp = require( 'FaceByPocket')
|
||||
local Cut = require( 'ProcessCut')
|
||||
|
||||
EgtOutLog( ' ProcessProfFront started', 1)
|
||||
@@ -167,6 +170,7 @@ end
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local sWarn
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -227,19 +231,38 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if nChamfer < 0 then
|
||||
return false, sChamfer
|
||||
end
|
||||
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
|
||||
-- se smusso non è esclusivo, aggiungo sgrossatura
|
||||
if nChamfer < 2 then
|
||||
-- aggiungo taglio di lama di sgrossatura e lo lavoro
|
||||
-- aggiungo piano di sgrossatura e lo lavoro
|
||||
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- applico la lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
|
||||
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
|
||||
-- recupero la lavorazione
|
||||
local sPockType = 'OpenPocket'
|
||||
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
|
||||
if not sPocketing then
|
||||
local sErr = 'Error : pocketing '..sPockType..' not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- eseguo le svuotature necessarie
|
||||
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se devo inserire il chamfer
|
||||
@@ -370,8 +393,104 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
-- verifico se necessario lavorare in doppio
|
||||
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
local sMillingDown
|
||||
if bDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
|
||||
if not sMillingDown then
|
||||
sWarn = 'Warning : milling from bottom not found in library'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
else
|
||||
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se orizzontale o trovata lavorazione per doppio verticale
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- se lavorazione da sopra e da sotto
|
||||
if ( nSide == 0) then
|
||||
if vtExtr:getZ() > 0.1 then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
-- altrimenti lavorazione davanti e dietro
|
||||
else
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
bFinish = true
|
||||
end
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||
-- e uscita
|
||||
ModifySideInvertLead( Proc, bHead, dToolDiam)
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
@@ -420,7 +539,6 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local ptSP, ptEp
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
|
||||
@@ -461,70 +579,10 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- sempre lavorazione da sopra o da sotto
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||
-- e uscita
|
||||
ModifySideInvertLead( Proc, bHead, dToolDiam)
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
|
||||
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
|
||||
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and bFirstTrim and
|
||||
( nSide ~= -1 or ( nSide == -1 and EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1)) then
|
||||
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD))) then
|
||||
-- se non da sotto, inserisco lavorazione finitura angolo
|
||||
--if nSide ~= -1 then
|
||||
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
@@ -547,7 +605,9 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
|
||||
-- imposto tipo uso faccia
|
||||
local nFaceUse = MCH_MILL_FU.PARAL_DOWN
|
||||
if nSide ~= 1 then
|
||||
if nSide == -1 then
|
||||
nFaceUse = EgtIf( vtN:getX() > 0.1, MCH_MILL_FU.PARAL_LEFT, MCH_MILL_FU.PARAL_RIGHT)
|
||||
elseif nSide ~= 1 then
|
||||
nFaceUse = EgtIf( vtN:getY() > 0.1, MCH_MILL_FU.PARAL_FRONT, MCH_MILL_FU.PARAL_BACK)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
@@ -587,7 +647,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX())
|
||||
-- end
|
||||
--end
|
||||
return true
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
+134
-78
@@ -1,9 +1,11 @@
|
||||
-- ProcessProfHead.lua by Egaltech s.r.l. 2022/02/02
|
||||
-- ProcessProfHead.lua by Egaltech s.r.l. 2022/05/28
|
||||
-- Gestione calcolo profilo di testa per Travi
|
||||
-- 2021/05/03 Aggiunta gestione smusso da sopra e sotto per macchina con testa sotto.
|
||||
-- 2021/06/28 Per macchine con testa sotto, smussi di lato con questa testa se non c'è lav.ne da sopra.
|
||||
-- 2021/10/12 Estesa gestione di testa da sotto, se presente.
|
||||
-- 2022/02/02 Aggiunta funzione OnlyChamfer.
|
||||
-- 2022/05/24 Aggiunta fresatura da sotto su macchine con testa da sotto.
|
||||
-- 2022/05/28 Aggiunto calcolo svuotatura da modulo di libreria.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessProfHead = {}
|
||||
@@ -11,6 +13,7 @@ local ProcessProfHead = {}
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Fbp = require( 'FaceByPocket')
|
||||
local Cut = require( 'ProcessCut')
|
||||
|
||||
EgtOutLog( ' ProcessProfHead started', 1)
|
||||
@@ -82,8 +85,8 @@ local function ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni, dLenLst,
|
||||
|
||||
-- confronto il punto iniziale e finale della lavorazione con il box della feature
|
||||
-- e se è vicino alla parte esterna della trave inverto la lavorazione
|
||||
ptSP = EgtGetMachiningStartPoint()
|
||||
ptEp = EgtGetMachiningEndPoint()
|
||||
local ptSP = EgtGetMachiningStartPoint()
|
||||
local ptEp = EgtGetMachiningEndPoint()
|
||||
local nMachMode = EgtGetMachiningParam( MCH_MP.STEPTYPE)
|
||||
if nMachMode == 1 and ptSP and ptEp then
|
||||
if abs( EgtIf( bHead, Proc.Box:getMax():getX(), Proc.Box:getMin():getX()) - ptSP:getX()) <
|
||||
@@ -259,19 +262,38 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if nChamfer < 0 then
|
||||
return false, sChamfer
|
||||
end
|
||||
-- se smusso non è esclusivo, aggiungo sgrossatura con taglio di lama
|
||||
-- se smusso non è esclusivo, aggiungo sgrossatura
|
||||
if nChamfer < 2 then
|
||||
-- aggiungo taglio di lama di sgrossatura e lo lavoro
|
||||
-- aggiungo piano di sgrossatura e lo lavoro
|
||||
local ptStart, vtNP = GetSawCutData( AuxId, vtN)
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB)
|
||||
if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then
|
||||
EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- applico la lavorazione
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura
|
||||
if BD.C_SIMM and not BD.DOWN_HEAD and vtNP:getZ() > 0 and vtNP:getX() > 0 and b3Raw:getDimZ() > 550 then
|
||||
-- recupero la lavorazione
|
||||
local sPockType = 'OpenPocket'
|
||||
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, true, false)
|
||||
if not sPocketing then
|
||||
local sErr = 'Error : pocketing '..sPockType..' not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- eseguo le svuotature necessarie
|
||||
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
-- altrimenti applico taglio di lama
|
||||
else
|
||||
local CutProc = { Id = AddId, Grp = Proc.Grp, Prc = Proc.Prc, Box = Proc.Box, Fct = Proc.Fct, Flg = Proc.Flg,
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se devo inserire il chamfer
|
||||
@@ -418,9 +440,108 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
-- verifico se necessario lavorare in doppio
|
||||
local bDouble = ( nSide ~= 0 and dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local bDouble = ( dProfDepth + BD.CUT_EXTRA > dToolMaxDepth)
|
||||
local dDepth = min( dToolMaxDepth, dProfDepth / 2 + BD.MILL_OVERLAP)
|
||||
-- inserisco la lavorazione
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
local sMillingDown
|
||||
if bDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
|
||||
if not sMillingDown then
|
||||
sWarn = 'Warning : milling from bottom not found in library'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
else
|
||||
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se orizzontale o trovata lavorazione per doppio verticale
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, EgtIf( BD.DOWN_HEAD and nSide == 0, sMillingDown, sMilling))
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- resetto il flag inversione percorso
|
||||
bFlagInvert = false
|
||||
-- se lavorazione da sopra e da sotto
|
||||
if ( nSide == 0) then
|
||||
if vtExtr:getZ() > 0.1 then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
-- altrimenti lavorazione davanti e dietro
|
||||
else
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
bFinish = true
|
||||
end
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||
-- e uscita
|
||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
|
||||
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- inserisco la prima lavorazione
|
||||
local sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchId then
|
||||
@@ -474,7 +595,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local ptSP, ptEp
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
local dOffsetPar = EgtGetInfo( Proc.Id, sOverMaterialForFinish, 'i') or 0
|
||||
@@ -516,70 +636,6 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se lavorazione da due parti, aggiungo la seconda
|
||||
if bDouble then
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'ProfB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- resetto il flag inversione percorso
|
||||
bFlagInvert = false
|
||||
-- sempre lavorazione da sopra o da sotto
|
||||
-- se lavorazione a destra di fronte o sinistra da dietro, inverto
|
||||
if ( bHead and vtExtr:getY() > 0.1) or
|
||||
( not bHead and vtExtr:getY() < -0.1) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
bFlagInvert = not bFlagInvert
|
||||
end
|
||||
-- imposto l'affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
-- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente
|
||||
if dOffsetPar > 0 then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar))
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
else
|
||||
-- applico controllo del punto entrata lavorazione e se non è distante dall'esterno
|
||||
-- della feature inverto il punto di inizio della lavorazione e modifico i parametri dell'attacco
|
||||
-- e uscita
|
||||
ModifySideInvertLead( Proc, bHead, dToolDiam, dLenIni,
|
||||
dLenLst, ( #vAngs > 0 and vAngs[1] == 0), ( #vAngs > 0 and vAngs[#vAngs] == (Proc.Fct-2)), bFlagInvert, dOffsetPar)
|
||||
end
|
||||
-- se abilitata, aggiungo lavorazione di finitura
|
||||
if bFinish then
|
||||
-- inserisco la lavorazione
|
||||
local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId))
|
||||
if not nMch2Id then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
else
|
||||
-- riporto il sovramateriale originale e tolgo i passi inutili
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOriOffset)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, dToolMaxMat)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMch2Id, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
|
||||
-- inserisco eventuale finitura faccia finale (ortogonale alla trave o, se da sotto, parallela)
|
||||
if EgtGetInfo( Proc.Id, sEnableExtraMillUpperFace, 'i') ~= 1 and #vAngs > 0 then
|
||||
@@ -681,7 +737,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
BL.UpdateTCING( nRawId, Proc.Box:getMin():getX() - b3Solid:getMin():getX())
|
||||
end
|
||||
end
|
||||
return true
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -137,23 +137,22 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
|
||||
local vCuts = {}
|
||||
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
||||
end
|
||||
if #vCuts > 0 then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- sistemo posizione nel DB e nome
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-- ProcessSawCut.lua by Egaltech s.r.l. 2022/03/07
|
||||
-- Gestione calcolo taglio di lama per Travi
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessSawCut = {}
|
||||
@@ -36,7 +37,10 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -71,7 +75,7 @@ function ProcessSawCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- altrimenti taglio di coda
|
||||
else
|
||||
-- se coincide con taglio di separazione, non va fatto
|
||||
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
|
||||
if AreSameVectorApprox( vtN, - X_AX()) and abs( ptC:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
-- ProcessScarfJoint.lua by Egaltech s.r.l. 2021/06/28
|
||||
-- Gestione calcolo giunto Gerber per Travi
|
||||
-- 2021/06/28 Aggiunto extra-taglio alle lamate orizzontali.
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessScarfJoint = {}
|
||||
@@ -198,7 +199,10 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -401,7 +405,7 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
bCut = false
|
||||
end
|
||||
-- se di coda e coincide con taglio di separazione, non va fatto
|
||||
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[5]], - X_AX()) and abs( ptC[vFaceOrd[5]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
|
||||
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[5]], - X_AX()) and abs( ptC[vFaceOrd[5]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
bCut = false
|
||||
end
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-- ProcessSimpleScarf.lua by Egaltech s.r.l. 2020/06/04
|
||||
-- Gestione calcolo giunto Gerber per Travi
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessSimpleScarf = {}
|
||||
@@ -124,7 +125,10 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- ingombro del pezzo
|
||||
@@ -208,7 +212,7 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
bCut = false
|
||||
end
|
||||
-- se di coda e coincide con taglio di separazione, non va fatto
|
||||
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
|
||||
if not bHead and AreSameVectorApprox( vtN[vFaceOrd[1]], - X_AX()) and abs( ptC[vFaceOrd[1]]:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
bCut = false
|
||||
end
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
@@ -218,25 +222,24 @@ function ProcessSimpleScarf.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if not bOk then return bOk, sNameOrErr end
|
||||
end
|
||||
end
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
|
||||
local vCuts = {}
|
||||
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
||||
elseif vFaceOrd[3] ~= 0 then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
|
||||
end
|
||||
if #vCuts > 0 then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- sistemo posizione nel DB e nome
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
end
|
||||
|
||||
+174
-7
@@ -1,5 +1,7 @@
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2022/01/25
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2022/06/07
|
||||
-- Gestione calcolo tagli di separazione per Travi
|
||||
-- 2022/05/31 Aggiunta gestione sezioni alte e larghe con taglio con sega a catena seguito da rifinitura con lama (aggiunta funzione MakeSplitByChainSaw); gestione eventuale creazione nuova fase dall'interno della Make.
|
||||
-- 2022/06/10 Per sezioni alte e larghe aggiunta gestione finitura in base a sovramateriale e a parametro Q05 dell' eventuale lavorazione sostituita.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessSplit = {}
|
||||
@@ -8,6 +10,9 @@ local ProcessSplit = {}
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Fbs = require( 'FacesBySaw')
|
||||
local LapJoint = require( 'ProcessLapJoint')
|
||||
local Cut = require( 'ProcessCut')
|
||||
local Pocket = require( 'FaceByPocket')
|
||||
|
||||
EgtOutLog( ' ProcessSplit started', 1)
|
||||
|
||||
@@ -140,9 +145,94 @@ local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
return true, nil
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- lavorazione con sega a catena per sezioni alte e larghe
|
||||
local function MakeSplitByChainSaw( nSurfId, nFaceUse, dDepth, sNotes, dOffs)
|
||||
-- Recupero i dati dell'utensile
|
||||
local sSawing = ML.FindSawing('Sawing')
|
||||
local dMaxMat = 0
|
||||
local dSawCornerRad = 0
|
||||
local dSawThick = 0
|
||||
-- se non trova una lavorazione di sawing esco
|
||||
if not sSawing then
|
||||
local sErr = 'Error : Sawing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr, 'MNF'
|
||||
else
|
||||
-- recupero i dati dell'utensile
|
||||
if EgtMdbSetCurrMachining( sSawing) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
|
||||
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
|
||||
dSawCornerRad = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) or dSawCornerRad
|
||||
end
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione di sawing
|
||||
local sName = 'Csaw_' .. ( EgtGetName( nSurfId) or tostring( nSurfId)) .. '_1'
|
||||
local nMchFId = EgtAddMachining( sName, sSawing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
sName = EgtGetOperationName( nMchFId)
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nSurfId, 0}})
|
||||
-- imposto uso del lato faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- imposto angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, LapJoint.GetChainSawBlockedAxis( 2))
|
||||
local _, vtN = EgtSurfTmFacetCenter( nSurfId, 0, GDB_ID.ROOT)
|
||||
vtOrthO = BL.GetVersRef( nFaceUse)
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, LapJoint.GetChainSawInitAngs( vtN, vtOrtho, 2))
|
||||
-- imposto offset radiale per mantenere il materiale in coda per la finitura
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||
-- imposto allungamento percorso iniziale e finale a zero
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0)
|
||||
-- faccio in modo che l'attacco della lama sia dal lato opposto rispetto al corpo macchina
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
if dMaxMat >= dDepth then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
|
||||
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
-- eventuali note
|
||||
if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
if EgtGetOutstrokeInfo() then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
-- impostazione alternativa angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, LapJoint.GetChainSawBlockedAxis( 1))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, LapJoint.GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
if EgtIsMachiningEmpty() then
|
||||
_, sWarn = EgtGetMachMgrWarning( 0)
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sWarn
|
||||
end
|
||||
--end
|
||||
return true, sName, nMchFId
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
|
||||
function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail)
|
||||
-- ingombro del grezzo
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- inserimento smussi
|
||||
@@ -170,10 +260,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
|
||||
end
|
||||
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
||||
-- caratteristiche taglio
|
||||
local bHorizCut = (( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
|
||||
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, BD.MAX_DIM_HTCUT_HBEAM)
|
||||
local bDoubleHorizCut = ( BD.DOWN_HEAD and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and ( b3Raw:getDimZ() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bHorizCut = ( not bBigSectionCut and ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA))
|
||||
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bBigSectionCut and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bDoubleCut = ( not bBigSectionCut and not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||
-- dati geometrici del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- flag di lavorazione faccia
|
||||
@@ -195,8 +286,84 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
|
||||
b3Raw:Add( b3NextRaw)
|
||||
end
|
||||
end
|
||||
-- se taglio per pezzi alti e larghi
|
||||
local nNewPhase = 0
|
||||
if bBigSectionCut then
|
||||
local bFinishingNeeded = false
|
||||
if bSplit then
|
||||
--taglio sega a catena
|
||||
local cutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN
|
||||
local sNotesSplit = 'Presplit;'
|
||||
local dOffs = 0
|
||||
if dOvmTail > BD.OVM_CHAIN_HBEAM then
|
||||
dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM
|
||||
bFinishingNeeded = true
|
||||
end
|
||||
local bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_BACK, cutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
sNotesSplit = 'Split;'
|
||||
bOk, sErr = MakeSplitByChainSaw( Proc.Id, MCH_MILL_FU.PARAL_FRONT, cutDepth, sNotesSplit, dOffs)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
-- creo nuova fase per successiva finitura
|
||||
BL.AddPhaseWithRawParts( nRawId, BD.OriXR, BD.PosXR, BD.RAW_OFFSET)
|
||||
nNewPhase = EgtGetCurrPhase()
|
||||
nDispId = EgtGetPhaseDisposition( nNewPhase)
|
||||
if sDownOrSideOrStd == 'down' then
|
||||
EgtRotateRawPart( nRawId, X_AX(), 180)
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||
EgtSetInfo( nDispId, 'ROT', -2)
|
||||
elseif sDownOrSideOrStd == 'side' then
|
||||
if bPreMove then EgtMoveRawPart( nRawId, vtMove) end
|
||||
EgtRotateRawPart( nRawId, X_AX(), EgtIf( BD.RIGHT_LOAD, -90, 90))
|
||||
if not bPreMove then EgtMoveRawPart( nRawId, vtMove) end
|
||||
EgtSetInfo( nDispId, 'TYPE', 'MID2')
|
||||
EgtSetInfo( nDispId, 'ROT', -1)
|
||||
else
|
||||
EgtSetInfo( nDispId, 'TYPE', 'END')
|
||||
end
|
||||
EgtSetInfo( nDispId, 'ORD', nOrd)
|
||||
-- se grezzo successivo senza pezzi e finale, va tolto
|
||||
local nNextRawId = EgtGetNextRawPart( nRawId)
|
||||
if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BD.MinRaw then
|
||||
EgtRemoveRawPartFromCurrPhase( nNextRawId)
|
||||
end
|
||||
-- fine creazione nuova fase
|
||||
end
|
||||
-- se è necessaria la finitura
|
||||
if bFinishingNeeded or not bSplit then
|
||||
local sNotes, sNotesFinal
|
||||
-- se non c'è separazione va aggiunta la nota Cut per l'ultimo taglio e Precut per i tagli precedenti
|
||||
if not bSplit then
|
||||
sNotes = 'Precut;'
|
||||
sNotesFinal = 'Cut;'
|
||||
end
|
||||
-- se finitura con lama
|
||||
if not nOriId or EgtGetInfo( nOriId, 'Q05', 'i') == 1 or EgtGetInfo( nOriId, 'Q05', 'i') == 0 or not bSplit then
|
||||
local bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dLenEndRaw, nil, false, true, b3Raw, sNotes, dCurrOvmT)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
-- se finitura con truciolatore
|
||||
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
local sErr = 'Error : part box not found'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local sPocketing = ML.FindPocketing( 'OpenPocket', nil, 0)
|
||||
if not sPocketing then
|
||||
local sErr = 'Error : pocketing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local bOk, sErr = Pocket.Make( Proc, Proc.Id, 0, sPocketing, nPartId, b3Solid)
|
||||
if not bOk then return bOk, sErr, nNewPhase end
|
||||
end
|
||||
if sNotesFinal then
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
|
||||
end
|
||||
end
|
||||
-- se tagli standard
|
||||
if not bDoubleHorizCut then
|
||||
elseif not bDoubleHorizCut then
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = 0
|
||||
local dAccStart = 0
|
||||
@@ -285,7 +452,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
return true
|
||||
return true, nil, nNewPhase
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -188,15 +188,15 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- se convesso, lo tratto come due tagli singoli
|
||||
if bConvex then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- lavoro per prima la faccia più diretta in alto
|
||||
local vOrd = { 1, 2}
|
||||
if vtN[2]:getZ() > vtN[1]:getZ() then
|
||||
@@ -244,20 +244,12 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
|
||||
end
|
||||
-- verifico se necessari tagli supplementari
|
||||
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
||||
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- sistemo posizione nel DB e nome
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
end
|
||||
@@ -380,7 +372,6 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- Taglio la faccia 2
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
@@ -388,6 +379,7 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- Taglio la faccia 2
|
||||
-- creo piano di taglio coincidente con la faccia 2 e lo lavoro
|
||||
local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptC[3], vtN[3], b3Solid, GDB_RT.GLOB)
|
||||
if AddId then
|
||||
@@ -406,13 +398,12 @@ local function MakeThreeFaces( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
|
||||
end
|
||||
-- verifico se necessari tagli supplementari
|
||||
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
||||
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 then
|
||||
-- sistemo posizione nel DB e nome
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
end
|
||||
|
||||
@@ -81,21 +81,20 @@ local function MachineByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Solid,
|
||||
if dAng < -90.5 and dAng > -179.5 then
|
||||
dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp
|
||||
end
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico se necessari tagli supplementari
|
||||
local vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
||||
local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd])
|
||||
--DC.PrintOrderCut( vCuts)
|
||||
if #vCuts > 0 then
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- sistemo posizione nel DB e nome
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
end
|
||||
|
||||
+26
-76
@@ -1,7 +1,9 @@
|
||||
-- ProcessTenon.lua by Egaltech s.r.l. 2022/02/15
|
||||
-- ProcessTenon.lua by Egaltech s.r.l. 2022/05/28
|
||||
-- Gestione calcolo tenone per Travi
|
||||
-- 2021/10/04 Corretto calcolo HCING per pezzi piccoli.
|
||||
-- 2022/02/15 Aggiornata VerifyOrientation per macchine con testa da sotto.
|
||||
-- 2022/05/18 Migliorata gestione attacco.
|
||||
-- 2022/05/28 Spostato calcolo svuotatura in modulo di libreria.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessTenon = {}
|
||||
@@ -9,6 +11,7 @@ local ProcessTenon = {}
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local BL = require( 'BeamLib')
|
||||
local Fbp = require( 'FaceByPocket')
|
||||
local Cut = require( 'ProcessCut')
|
||||
|
||||
EgtOutLog( ' ProcessTenon started', 1)
|
||||
@@ -78,41 +81,6 @@ function ProcessTenon.Classify( Proc, b3Raw)
|
||||
return true, bDown
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function ApplyPocket( Proc, sPocketing, nStep, dSurfStep, nIdSurf, vtExtr)
|
||||
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. nStep
|
||||
local nMchFId = EgtAddMachining( sName, sPocketing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nIdSurf, -1}})
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
|
||||
if dSurfStep > 0 then
|
||||
-- imposto elevazione
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dSurfStep, 2) .. ';'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
end
|
||||
-- imposto posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM and not BD.TURN then
|
||||
nSCC = EgtIf( vtExtr:getX() < GEO.EPS_SMALL, MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
@@ -160,8 +128,6 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- abilitazione lavorazione da sotto
|
||||
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
||||
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
||||
-- porto inizio curva il più possibile sul bordo
|
||||
BL.PutStartNearestToEdge( AuxId, b3Solid, bMillDown and not bShortPart)
|
||||
-- se vero tenone inclinato o non esattamente alle estremità, necessario taglio di lama sulla testa
|
||||
if Proc.Prc ~= 52 and
|
||||
( not AreSameOrOppositeVectorApprox( vtN, X_AX()) or
|
||||
@@ -181,43 +147,16 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtSetInfo( AddId, 'TASKID', Proc.TaskId)
|
||||
-- se pezzo piccolo, in coda, con piano inclinato verso il basso e macchina con testa da sotto applico svuotatura
|
||||
if bShortPart and vtExtr:getX() < 0 and vtExtr:getZ() < -0.09 and BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
local sPockType = EgtIf( bMillDown, 'OpenPocket_H2', 'OpenPocket')
|
||||
local sPocketing = ML.FindPocketing( sPockType, nil, nil, nil, not bMillDown, bMillDown)
|
||||
local dMaxDepth = 100
|
||||
local dStep = 30
|
||||
local nSurfStep
|
||||
-- acquisisco i dati necessari dall'utensile
|
||||
if EgtMdbSetCurrMachining( sPocketing) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
dStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or dStep
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
-- acquisisco elevazione
|
||||
local dElev = BL.GetFaceElevation( AddId, 0, nPartId)
|
||||
nSurfStep = ceil( dElev / dMaxDepth)
|
||||
dSurfStep = dElev / nSurfStep
|
||||
local bOk = true
|
||||
local sErr
|
||||
-- copio superfice al passo superfice e ci applico la lavorazione
|
||||
for i = nSurfStep, 2, -1 do
|
||||
local nAddIdTmp = EgtSurfTmPlaneInBBox( nAddGrpId, ptC+((dSurfStep*(i-1))*vtN), vtN, b3Solid, GDB_RT.GLOB)
|
||||
if nAddIdTmp then
|
||||
EgtSetName( nAddIdTmp, 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( nAddIdTmp, 'TASKID', Proc.TaskId)
|
||||
-- aggiungo lavorazione
|
||||
bOk, sErr = ApplyPocket( Proc, sPocketing, i, (dSurfStep + 0), nAddIdTmp, vtExtr)
|
||||
if not bOk then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not bOk then
|
||||
if not sPocketing then
|
||||
local sErr = 'Error : pocketing '..sPockType..' not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- faccio ultima superfice
|
||||
bOk, sErr = ApplyPocket( Proc, sPocketing, 1, EgtIf( nSurfStep > 1, ( dSurfStep + 0), 0), AddId, vtExtr)
|
||||
-- eseguo le svuotature necessarie
|
||||
local bOk, sErr = Fbp.Make( Proc, AddId, 0, sPocketing, nPartId, b3Solid)
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
@@ -228,13 +167,18 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
Head = Proc.Head, Tail = Proc.Tail, CutId = Proc.CutId, TaskId = Proc.TaskId}
|
||||
local bFromBottom = ( bShortPart and vtExtr:getZ() > 0.25)
|
||||
local bOk, sErr = Cut.Make( CutProc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom)
|
||||
if not bOk then return bOk, sErr end
|
||||
if not bOk then
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- recupero la lavorazione
|
||||
local sMillType = 'Tenon'
|
||||
local sMilling = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown) or ML.FindMilling( sMillType, nil, nil, nil, bMillUp, bMillDown)
|
||||
local sMilling, _, _, bH2 = ML.FindMilling( sMillType, dTenH, nil, nil, nil, bMillUp, bMillDown)
|
||||
if not sMilling then
|
||||
sMilling, _, _, bH2 = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
|
||||
end
|
||||
if not sMilling then
|
||||
local sErr = 'Error : milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -253,6 +197,13 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
bCW = ( dSpeed >= 0)
|
||||
end
|
||||
end
|
||||
-- massimo numero di passate e coefficiente di sovrapposizione ta passate
|
||||
local MAX_PASS = 6
|
||||
local OVERLAP_COEFF = 0.7
|
||||
-- porto inizio curva il più possibile sul bordo in alto o in basso
|
||||
local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS
|
||||
local bMyShortPart = ( bShortPart and abs( vtN:getX()) < 0.999)
|
||||
BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, bH2 ~= bMyShortPart)
|
||||
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
|
||||
local sWarn
|
||||
local dDepth = 0
|
||||
@@ -263,9 +214,8 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
|
||||
end
|
||||
-- determino il numero di passate concentriche (max 6)
|
||||
local MAX_PASS = 6
|
||||
local nPass = min( ceil( dPockL / ( 0.7 * dMillDiam)), MAX_PASS)
|
||||
local dStep = min( dPockL, 0.7 * dMillDiam * MAX_PASS) / nPass
|
||||
local nPass = min( ceil( dPockL / ( OVERLAP_COEFF * dMillDiam)), MAX_PASS)
|
||||
local dStep = min( dPockL, OVERLAP_COEFF * dMillDiam * MAX_PASS) / nPass
|
||||
for i = nPass, 1, -1 do
|
||||
-- inserisco la passata finale della lavorazione
|
||||
local sNameF = 'TenF_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-- ProcessTyroleanDovetail.lua by Egaltech s.r.l. 2022/03/21
|
||||
-- Gestione calcolo giunzione tirolese
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe)
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessTyroleanDovetail = {}
|
||||
@@ -141,7 +142,7 @@ local function EvaluateQParam( Proc, sDephtCham)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
|
||||
local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt, dOvmTail)
|
||||
|
||||
-- dati delle facce
|
||||
local ptC = {}
|
||||
@@ -208,7 +209,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -224,7 +225,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
|
||||
bCut = false
|
||||
end
|
||||
-- se di coda e coincide con taglio di separazione, non va fatto
|
||||
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
|
||||
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
bCut = false
|
||||
end
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
@@ -256,15 +257,14 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
|
||||
-- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti
|
||||
local vCuts = {}
|
||||
if vFaceOrd[2] ~= 0 and vFaceOrd[3] ~= 0 then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], false, ptC[vFaceOrd[2]], vtN[vFaceOrd[2]])
|
||||
elseif vFaceOrd[3] ~= 0 then
|
||||
vCuts = DC.GetDice( EgtGetParent( Proc.Id), b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[3]], vtN[vFaceOrd[3]], true)
|
||||
end
|
||||
if #vCuts > 0 then
|
||||
-- sistemo posizione nel DB e nome
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
EgtRelocateGlob( vCuts[i][j], nAddGrpId)
|
||||
EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id))
|
||||
EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId)
|
||||
end
|
||||
@@ -323,7 +323,7 @@ local function MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw,
|
||||
bCut = false
|
||||
end
|
||||
-- se di coda e coincide con taglio di separazione, non va fatto
|
||||
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < BD.OVM_MID + 10 * GEO.EPS_SMALL then
|
||||
if not bHead and AreSameVectorApprox( vtNAux, - X_AX()) and abs( ptCAux:getX() - b3Raw:getMin():getX()) < dOvmTail + 10 * GEO.EPS_SMALL then
|
||||
bCut = false
|
||||
end
|
||||
-- se va fatto, inserisco la lavorazione
|
||||
@@ -477,7 +477,7 @@ local function MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' missing AddGroup'
|
||||
local sErr = 'Error : missing AddGroup'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
@@ -672,7 +672,10 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTail)
|
||||
if not dOvmTail then
|
||||
dOvmTail = BD.OVM_MID
|
||||
end
|
||||
-- recupero l'ingombro del grezzo di appartenenza
|
||||
local b3Raw = EgtGetRawPartBBox( nRawId)
|
||||
-- in base al tipo di feature attribuisco il significato dei parametri Q
|
||||
@@ -694,7 +697,7 @@ function ProcessTyroleanDovetail.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
-- se ho due facce allora è di testa
|
||||
if nFacetCnt == 2 then
|
||||
local bOk, sErr = MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
|
||||
local bOk, sErr = MakeMachByBlade( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt, dOvmTail)
|
||||
if not bOk then return bOk, sErr end
|
||||
else
|
||||
local bOk, sErr = MakeMachByMill( Proc, nPhase, nRawId, nPartId, dOvmHead, b3Raw, b3Solid, nFacetCnt)
|
||||
|
||||
+2
-1
@@ -131,7 +131,7 @@ local function TotPartLen(Parts)
|
||||
end
|
||||
|
||||
-- Imposto direttorio libreria specializzata per Travi
|
||||
EgtAddToPackagePath( NEST.BASEDIR .. 'LuaLibs\\?.lua')
|
||||
EgtAddToPackagePath( NEST.BASEDIR .. '\\LuaLibs\\?.lua')
|
||||
|
||||
-- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi
|
||||
EgtSetCurrMachine( NEST.MACHINE)
|
||||
@@ -311,6 +311,7 @@ _G.BEAM = {}
|
||||
BEAM.FILE = NEST.FILE
|
||||
BEAM.MACHINE = NEST.MACHINE
|
||||
BEAM.FLAG = 6 -- CREATE_PANEL
|
||||
BEAM.BASEDIR = NEST.BASEDIR
|
||||
nMachGroup = EgtGetFirstMachGroup()
|
||||
while nMachGroup do
|
||||
local nNextMachGroup = EgtGetNextMachGroup( nMachGroup)
|
||||
|
||||
Reference in New Issue
Block a user