Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 706d9efa9d | |||
| 4fdafa34c5 | |||
| 66541894ea | |||
| 1198a34cd2 | |||
| 41412b6cca | |||
| bef986e453 | |||
| 5b334d8fa7 | |||
| edb0f70a27 | |||
| 808f92fa36 | |||
| 6407057400 | |||
| 2f63cd84e3 | |||
| 798696a5a6 | |||
| 8a3b9d4706 | |||
| 0fdc2b8d15 | |||
| 9915cd2d42 | |||
| 432a8a9347 | |||
| cc6d21baf6 | |||
| bc5d904680 | |||
| 58905b88ba | |||
| 68f40aed58 | |||
| d91c31974e | |||
| a217b95c35 | |||
| 05aae0b8f3 | |||
| 629dfc1341 | |||
| e9cb756dc9 | |||
| 9b888a0a59 | |||
| b141a512bb | |||
| d13f108dad | |||
| 7762692597 | |||
| 04b0650f96 | |||
| 8b31881abb | |||
| 055d8bd4d3 | |||
| b0e10cee87 | |||
| a9e43984a2 | |||
| 1e93303981 | |||
| 7fec3d6584 | |||
| e61cc2ba08 | |||
| 516a56c8b5 | |||
| 2482338a12 | |||
| 0528ac4a31 | |||
| 4e77597b7d | |||
| 058babe605 | |||
| a7676c7331 | |||
| f1abaeaac3 | |||
| 5db6398725 | |||
| a8924f4425 | |||
| e4c5a2e06d | |||
| 29ed56df16 | |||
| 6d64f2232d | |||
| e0abdbbe63 | |||
| 45afa144ad | |||
| dc4a0eda3e | |||
| b0cdb95e48 | |||
| 53e8605297 | |||
| 41e490dcd2 | |||
| 56f66d66c3 | |||
| 7497b62dee | |||
| e67e397225 | |||
| a972fbd425 | |||
| d5140acc91 | |||
| b197c96a34 | |||
| f3a72a7683 | |||
| d72560241b | |||
| 0689328082 | |||
| a1a6f2243a |
+2
-3
@@ -2,9 +2,8 @@ variables:
|
||||
VERS_MAIN: '1.0'
|
||||
APP_NAME: 'Beam'
|
||||
NEW_REL: ''
|
||||
NET_SHARE_R: '\\10.74.82.201\Artifacts\EGT_SRV\EgtTech'
|
||||
NET_USER: '10.74.82.50\Server'
|
||||
NET_SHARE_Z: '\\10.74.82.200\Artifacts'
|
||||
NET_SHARE_R: '\\10.74.82.201\EgwTech'
|
||||
NET_SHARE_Z: '\\10.74.82.201\Artifacts'
|
||||
NET_USERQ: 'steamw\egalware'
|
||||
|
||||
#Note compilazione LUA:
|
||||
|
||||
+33
-3
@@ -1,4 +1,4 @@
|
||||
-- BeamExec.lua by Egaltech s.r.l. 2022/08/08
|
||||
-- BeamExec.lua by Egaltech s.r.l. 2022/09/24
|
||||
-- Libreria esecuzione lavorazioni per Travi
|
||||
-- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3.
|
||||
-- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato.
|
||||
@@ -34,6 +34,8 @@
|
||||
-- controllata tramite il parametro IMPROVE_HEAD_TAIL_DRILLINGS da BeamData. Attivata di default.
|
||||
-- 2022/08/01 Tolleranza su sezione portata a 0.1 mm (100 * GEO.EPS_SMALL).
|
||||
-- 2022/08/08 Modifica per macchine senza BD.MAX_WIDTH2 e BD.MAX_HEIGHT2.
|
||||
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
|
||||
-- 2022/09/21 Nella funzione di ordinamento il foro del birdsmouth viene sempre fatto prima della lavorazione stessa
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local BeamExec = {}
|
||||
@@ -257,6 +259,9 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
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
|
||||
-- leggo se ci sono feature collegate
|
||||
local nAddAdjId = EgtGetInfo( ProcId, 'ADJID', 'i')
|
||||
local nAddMainId = EgtGetInfo( ProcId, 'MAINID', 'i')
|
||||
if nGrp and nPrc and nDo == 1 then
|
||||
local Proc = {}
|
||||
Proc.Id = ProcId
|
||||
@@ -269,6 +274,12 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
Proc.Fce = 0
|
||||
Proc.CutId = nCutId
|
||||
Proc.TaskId = nTaskId
|
||||
-- se ci sono feature collegate ne scrivo il riferimento nella Proc
|
||||
if nAddAdjId then
|
||||
Proc.AdjId = Proc.Id + nAddAdjId
|
||||
elseif nAddMainId then
|
||||
Proc.MainId = Proc.Id + nAddMainId
|
||||
end
|
||||
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
|
||||
if Proc.Box and not Proc.Box:isEmpty() then
|
||||
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
@@ -391,6 +402,7 @@ end
|
||||
-- *** Inserimento delle travi nel grezzo ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function VerifyBigSectionCut( dRawW, dRawH)
|
||||
-- lama principale
|
||||
local sCutting = ML.FindCutting( 'TailSide')
|
||||
local dMaxDepth = 50
|
||||
if EgtMdbSetCurrMachining( sCutting or '') then
|
||||
@@ -400,9 +412,19 @@ local function VerifyBigSectionCut( dRawW, dRawH)
|
||||
end
|
||||
end
|
||||
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
||||
-- eventuale lama su testa sotto
|
||||
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
|
||||
local dMaxDepth2 = 0
|
||||
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
|
||||
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
|
||||
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
|
||||
end
|
||||
end
|
||||
-- verifiche
|
||||
local dDimYRef = EgtIf( dRawH < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
|
||||
local bBigSectionCut = ( dRawW > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
|
||||
( dRawH > EgtIf( BD.DOWN_HEAD or BD.TURN, 2, 1) * dMaxVertDepth - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
( dRawH > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
return bBigSectionCut
|
||||
end
|
||||
|
||||
@@ -658,6 +680,14 @@ local function OrderFeatures( vProc, b3Raw)
|
||||
if B1.Head ~= B2.Head then
|
||||
return B1.Head
|
||||
end
|
||||
-- se primo è foro di un birdsmouth e secondo è il suo birdsmouth, il foro va sempre prima
|
||||
if Drill.Identify(B1) and LapJoint.Identify(B2) and B1.MainId == B2.Id then
|
||||
return true
|
||||
end
|
||||
-- se primo è birdsmouth e secondo è il suo foro, il birdsmouth va sempre dopo
|
||||
if LapJoint.Identify(B1) and Drill.Identify(B2) and B1.AdjId == B2.Id then
|
||||
return false
|
||||
end
|
||||
-- se entrambi tenoni e si intersecano, metto prima tenone vero e poi base tenone
|
||||
if ( Tenon.Identify( B1) or DtTenon.Identify( B1)) and ( Tenon.Identify( B2) or DtTenon.Identify( B2)) and
|
||||
B1.Box:getMin():getX() < B2.Box:getMax():getX() + 100 * GEO.EPS_SMALL and B2.Box:getMin():getX() < B1.Box:getMax():getX() + 100 * GEO.EPS_SMALL then
|
||||
@@ -1226,7 +1256,7 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
|
||||
EgtOutLog( sErr)
|
||||
bOk = false
|
||||
end
|
||||
return bOk, sErr, nNewPhase
|
||||
return bOk, sErr, ( nNewPhase or -1)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
+237
-2
@@ -16,6 +16,7 @@
|
||||
-- 2022/07/12 A GetFaceHvRefDim aggiunta possibilità di confronto e limitazione dimensioni con grezzo/pezzo (conta solo la sezione).
|
||||
-- 2022/07/26 Aggiunta la funzione FindFaceBestOrientedAsAxis, precedentemente in ProcessLapJoint
|
||||
-- 2022/07/26 Alla funzione FindFaceBestOrientedAsAxis aggiunta la possibilità di escludere una faccia dalla ricerca
|
||||
-- 2022/09/01 Aggiunte le funzioni GetTunnelDimension, CalcCollisionSafety, SetOpenSide, precedentemente in ProcessLapJoint.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local BeamLib = {}
|
||||
@@ -307,7 +308,7 @@ function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm)
|
||||
vtMyRef:normalize()
|
||||
end
|
||||
-- se prevalente una componente orizzontale (con piccolissimo vantaggio)
|
||||
if abs( vtMyRef:getX()) > 0.95 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.95 * abs( vtMyRef:getZ()) then
|
||||
if abs( vtMyRef:getX()) > 0.91 * abs( vtMyRef:getZ()) or abs( vtMyRef:getY()) > 0.91 * 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
|
||||
@@ -702,8 +703,10 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho)
|
||||
if BD.C_SIMM or BD.TURN then
|
||||
if BD.C_SIMM then
|
||||
return -0.484
|
||||
elseif BD.TURN then
|
||||
return -2
|
||||
else
|
||||
if vtOrtho and vtOrtho:getZ() > 0.35 then
|
||||
-- N_HorAng < 15° or N_HorAng > 55°
|
||||
@@ -814,5 +817,237 @@ function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude)
|
||||
return nFaceIndMax, ptC, vtN
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.GetTunnelDimension( Proc, nPartId)
|
||||
-- sono necessarie almeno due facce
|
||||
if Proc.Fct < 2 then return 0, 0, 0 end
|
||||
-- recupero l'ingombro della trave
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- recupero centro e normale delle facce
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
for i = 1, Proc.Fct do
|
||||
ptC[i], vtN[i] = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||
end
|
||||
-- calcolo l'orientamento del tunnel
|
||||
local vtOrtho
|
||||
local bAdj = EgtSurfTmFacetsContact( Proc.Id, 0, 1)
|
||||
if bAdj then
|
||||
vtOrtho = vtN[1] ^ vtN[2]
|
||||
else
|
||||
if Proc.Fct >= 3 then
|
||||
vtOrtho = vtN[1] ^ vtN[3]
|
||||
else
|
||||
return 0, 0, 0
|
||||
end
|
||||
end
|
||||
-- ottengo il boundingBox e prendo le dimensioni lungo la direzione (Z locale) che rappresenta la profondità della fessura
|
||||
local frFc = Frame3d( ptC[1], vtOrtho) ;
|
||||
local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc)
|
||||
local dDepth = b3BoxLoc:getDimZ()
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BeamLib.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
EgtOutLog( 'Error : missing AddGroup')
|
||||
return 0, 0, 0
|
||||
end
|
||||
-- centro del bounding box locale
|
||||
local ptCen = b3BoxLoc:getCenter()
|
||||
ptCen:toGlob( frFc)
|
||||
-- creo superficie intermedia
|
||||
local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, ptCen, vtOrtho, b3Solid, GDB_ID.ROOT)
|
||||
if not nSurfInt then return 0, 0, 0 end
|
||||
-- ritaglio la superficie con le facce della fessura
|
||||
for i = 1, Proc.Fct do
|
||||
EgtCutSurfTmPlane( nSurfInt, ptC[i], -vtN[i], false, GDB_ID.ROOT)
|
||||
end
|
||||
local frSurfInt, dDimMax, dDimMin = EgtSurfTmFacetMinAreaRectangle( nSurfInt, 0, GDB_ID.ROOT)
|
||||
-- cerco la faccia con larghezza pari a dimensione massima della fessura
|
||||
local nLongIdFace = 0
|
||||
for i = 1, Proc.Fct do
|
||||
if abs( vtN[i] * frSurfInt:getVersX()) < 0.5 then
|
||||
nLongIdFace = i - 1
|
||||
break
|
||||
end
|
||||
end
|
||||
return dDimMin, dDimMax, dDepth, vtOrtho, nLongIdFace, nSurfInt
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.CalcCollisionSafety( vtDir)
|
||||
local dCollSic = 10 * BD.COLL_SIC
|
||||
if abs( vtDir:getX()) > 0.999 or abs( vtDir:getY()) > 0.999 or abs( vtDir:getZ()) > 0.999 then
|
||||
dCollSic = 0
|
||||
elseif abs( vtDir:getX()) > 0.996 or abs( vtDir:getY()) > 0.996 or abs( vtDir:getZ()) > 0.996 then
|
||||
dCollSic = 1 * BD.COLL_SIC
|
||||
elseif abs( vtDir:getX()) > 0.89 or abs( vtDir:getY()) > 0.89 or abs( vtDir:getZ()) > 0.89 then
|
||||
dCollSic = 2.5 * BD.COLL_SIC
|
||||
elseif abs( vtDir:getX()) > 0.86 or abs( vtDir:getY()) > 0.86 or abs( vtDir:getZ()) > 0.86 then
|
||||
dCollSic = 4 * BD.COLL_SIC
|
||||
elseif abs( vtDir:getX()) > 0.707 or abs( vtDir:getY()) > 0.707 or abs( vtDir:getZ()) > 0.707 then
|
||||
dCollSic = 5.5 * BD.COLL_SIC
|
||||
end
|
||||
return dCollSic
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function BeamLib.SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId, nStartPoint)
|
||||
|
||||
-- fondo tra loro le curve compatibili
|
||||
EgtMergeCurvesInCurveCompo( nPathInt)
|
||||
local nStartIdEnt, nNumEnt = EgtCurveDomain( nPathInt)
|
||||
local pLastPIni, pLastPEnd
|
||||
|
||||
-- faccio una copia della curva e la esplodo
|
||||
if nStartIdEnt then
|
||||
-- prendo i punti
|
||||
for i = 1, nNumEnt do
|
||||
local pPini = EgtUP( nPathInt, (i-1), GDB_RT.GLOB)
|
||||
local pPend = EgtUP( nPathInt, EgtIf( i == nNumEnt, 0, i), GDB_RT.GLOB)
|
||||
-- Se normale lungo la Z considero il box in X e Y
|
||||
if abs(vtOrtho:getZ()) > 0.999 then
|
||||
-- se corrisponde a X
|
||||
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
-- altrimenti se corrisponde a Y
|
||||
elseif ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
end
|
||||
-- altrimenti se normale lungo la Y considero il box in X e Z
|
||||
elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getY()) > 0.999 then
|
||||
-- se corrisponde a X
|
||||
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
-- altrimenti se corrisponde a Z
|
||||
elseif ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
end
|
||||
-- caso che non dovrebbe mai capitare ma gestito per completezza
|
||||
-- altrimenti se normale lungo la X considero il box in Y e Z
|
||||
elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getX()) > 0.999 then
|
||||
-- se corrisponde a Y
|
||||
if ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
-- altrimenti se corrisponde a Z
|
||||
elseif ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
end
|
||||
-- se asse Z orizzontale verifico se si avvicina piú a Y
|
||||
elseif abs(vtOrtho:getZ()) < 0.001 then
|
||||
if abs(vtOrtho:getY()) > 0.75 then
|
||||
-- se corrisponde a Z
|
||||
if ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
end
|
||||
end
|
||||
-- se asse Y a 0 (fresa ne davanti ne dietro) verifico se si avvicina piú a Z+
|
||||
elseif abs(vtOrtho:getY()) < 0.001 then
|
||||
if abs(vtOrtho:getZ()) > 0.75 then
|
||||
-- se corrisponde a Y
|
||||
if ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se devo cambiare il punto di partenza
|
||||
if nStartPoint then
|
||||
if pLastPIni and pLastPEnd then
|
||||
-- calcolo il punto medio con gli ultimi punti utilizzati
|
||||
local ptPs = ( pLastPIni + pLastPEnd) / 2
|
||||
EgtChangeClosedCurveStartPoint( nPathInt, ptPs, GDB_RT.GLOB)
|
||||
-- se devo eliminare la parte open
|
||||
if nStartPoint == 2 then
|
||||
EgtRemoveCurveCompoCurve( nPathInt, true)
|
||||
EgtRemoveCurveCompoCurve( nPathInt, false)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return BeamLib
|
||||
|
||||
@@ -496,6 +496,12 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl
|
||||
if bDownHead and vtO:getZ() > 0.05 then
|
||||
vtO = -vtO
|
||||
end
|
||||
-- per macchina TURN
|
||||
if BD.TURN then
|
||||
if vtO:getY() > 0.707 then
|
||||
vtO = -vtO
|
||||
end
|
||||
end
|
||||
-- calcolo le dimensioni dell'offset e dove posizionare la prima faccia:
|
||||
-- CopyPlane: 0 => crea la prima faccia direttamente sul punto passato
|
||||
-- CopyPlane: 1 => crea la prima faccia e tutte le altre con l'offset passato
|
||||
|
||||
+59
-45
@@ -1,4 +1,4 @@
|
||||
-- FacesBySaw.lua by Egaltech s.r.l. 2022/06/29
|
||||
-- FacesBySaw.lua by Egaltech s.r.l. 2022/09/24
|
||||
-- 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.
|
||||
@@ -12,6 +12,7 @@
|
||||
-- 2021/11/26 DS Spostate qui MakeOneFaceBySaw (ora MakeOne), CalcLeadInOutPerpGeom e CalcLeadInOutTangGeom.
|
||||
-- 2022/04/12 DS Aggiunta gestione speciale cubetti con fresa da sotto.
|
||||
-- 2022/06/29 DS In MakeTwo modificato controllo facce dirette verso il basso.
|
||||
-- 2022/09/08 In MakeOne aggiunto argomento bForceInvert per poter forzare l'inversione del percorso.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local FacesBySaw = {}
|
||||
@@ -28,7 +29,7 @@ local BD = require( 'BeamData')
|
||||
local ML = require( 'MachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
|
||||
function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert)
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
|
||||
-- risolvo parametro ambiguo
|
||||
@@ -51,7 +52,10 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
return true, ''
|
||||
end
|
||||
vtV1 = - vtV1
|
||||
local bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
|
||||
local bInvert = bForceInvert
|
||||
if bInvert == nil then
|
||||
bInvert = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL)
|
||||
end
|
||||
if bInvert then
|
||||
ptP1, ptP2 = ptP2, ptP1
|
||||
vtV1, vtV2 = vtV2, vtV1
|
||||
@@ -122,7 +126,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw
|
||||
local ptP1act = ptP1 + vtN * dCutOffset
|
||||
local ptP2act = ptP2 + vtN * dCutOffset
|
||||
-- attacco perpendicolare
|
||||
local dLiTang, dLiPerp, dLoTang, dLoPerp = FacesBySaw.CalcLeadInOutPerpGeom( ptP1act, ptP2act, vtV1, vtV2, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
|
||||
local dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio = FacesBySaw.CalcLeadInOutPerpGeom( ptP1act, ptP2act, vtV1, vtV2, vtN, dSawDiam/2, vtRef, dCutExtra, b3Box)
|
||||
local dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp)
|
||||
local dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp)
|
||||
-- attacco tangente
|
||||
@@ -156,11 +160,26 @@ 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
|
||||
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)
|
||||
if bTurnTang then
|
||||
local vtTest = EgtIf( bInvert, vtTg, -vtTg)
|
||||
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
|
||||
else
|
||||
nSCC = EgtIf( vtTest:getZ() > 0, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||
local vtTest = vtOut -- vtLio
|
||||
if abs( vtN:getY()) < 0.174 and abs( vtN:getZ()) < 0.174 then
|
||||
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
|
||||
elseif abs( vtN:getZ()) < 0.174 then
|
||||
nSCC = EgtIf( vtTest:getZ() > -0.017, MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM)
|
||||
else
|
||||
nSCC = EgtIf( vtTest:getY() > 0, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione di taglio
|
||||
@@ -460,29 +479,24 @@ function FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vt
|
||||
local vtX = vtTg ^ vtN
|
||||
local frFace = Frame3d( ptP1, vtX, vtTg, vtN)
|
||||
EgtOutLog( 'Vref=' .. tostring( vtRef) .. ' V1=' .. tostring( vtV1) .. ' V2=' .. tostring( vtV2), 3)
|
||||
-- Versori di attacco e uscita
|
||||
-- Versore di attacco e uscita
|
||||
local dCos1 = vtV1 * vtRef
|
||||
local dCos2 = vtV2 * vtRef
|
||||
local vtLi, vtLo
|
||||
local vtLio
|
||||
if abs( dCos1 - dCos2) < 0.001 then
|
||||
if abs( vtV1:getZ()) < abs( vtV2:getZ()) then
|
||||
vtLi = vtV1
|
||||
vtLo = vtV1
|
||||
vtLio = vtV1
|
||||
else
|
||||
vtLi = vtV2
|
||||
vtLo = vtV2
|
||||
vtLio = vtV2
|
||||
end
|
||||
elseif dCos1 > dCos2 then
|
||||
vtLi = vtV1
|
||||
vtLo = vtV1
|
||||
vtLio = vtV1
|
||||
else
|
||||
vtLi = vtV2
|
||||
vtLo = vtV2
|
||||
vtLio = vtV2
|
||||
end
|
||||
local bRight = ( vtX * vtLi > 0)
|
||||
-- Versori di attacco e uscita nel riferimento intrinseco al taglio
|
||||
local vtLiL = Vector3d( vtLi) ; vtLiL:toLoc( frFace)
|
||||
local vtLoL = Vector3d( vtLo) ; vtLoL:toLoc( frFace)
|
||||
local bRight = ( vtX * vtLio > 0)
|
||||
-- Versore di attacco e uscita nel riferimento intrinseco al taglio
|
||||
local vtLioL = Vector3d( vtLio) ; vtLioL:toLoc( frFace)
|
||||
-- Spostamento punti per effetto dell'extra o della deficienza di taglio
|
||||
ptP1 = ptP1 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
|
||||
ptP2 = ptP2 + vtX * ( EgtIf( bRight, - dCutExtra, dCutExtra))
|
||||
@@ -492,30 +506,30 @@ function FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vt
|
||||
-- Attacco
|
||||
local dLiTang = 10000
|
||||
local dLiPerp = 10000
|
||||
local bLiOk, _, vLiPar = EgtLineBoxInters( ptP1, vtLi, b3MyBox)
|
||||
local bLiOk, _, vLiPar = EgtLineBoxInters( ptP1, vtLio, b3MyBox)
|
||||
if bLiOk and #vLiPar > 0 then
|
||||
-- con la prima faccia di uscita
|
||||
local dLen = vLiPar[#vLiPar]
|
||||
local ptInt = ptP1 + vtLi * dLen
|
||||
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLi)
|
||||
local ptInt = ptP1 + vtLio * dLen
|
||||
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLio)
|
||||
EgtOutLog( 'LiFaceNorm=' .. tostring( vtFN), 3)
|
||||
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLi * vtFN)
|
||||
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLio * vtFN)
|
||||
local dLiLen = dLen + dAddLen
|
||||
EgtOutLog( 'LeadIn Dist=' .. EgtNumToString( dLiLen), 3)
|
||||
dLiTang = - dLiLen * vtLiL:getY()
|
||||
dLiPerp = EgtIf( bRight, dLiLen, - dLiLen) * vtLiL:getX()
|
||||
dLiTang = - dLiLen * vtLioL:getY()
|
||||
dLiPerp = EgtIf( bRight, dLiLen, - dLiLen) * vtLioL:getX()
|
||||
-- verifico se miglioro calcolando con faccia successiva
|
||||
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
|
||||
local bLiOk2, _, vLiPar2 = EgtLineBoxInters( ptP1, vtLi, b3Mod)
|
||||
local bLiOk2, _, vLiPar2 = EgtLineBoxInters( ptP1, vtLio, b3Mod)
|
||||
if bLiOk2 and #vLiPar2 > 0 then
|
||||
local dLen2 = vLiPar2[#vLiPar2]
|
||||
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP1 + vtLi * dLen2, vtLi)
|
||||
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP1 + vtLio * dLen2, vtLio)
|
||||
EgtOutLog( 'LiFaceNorm2=' .. tostring( vtFN2), 3)
|
||||
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLi * vtFN2)
|
||||
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLio * vtFN2)
|
||||
local dLiLen2 = dLen2 + dAddLen2
|
||||
EgtOutLog( 'LeadIn Dist2=' .. EgtNumToString( dLiLen2), 3)
|
||||
local dLiTang2 = - dLiLen2 * vtLiL:getY()
|
||||
local dLiPerp2 = EgtIf( bRight, dLiLen2, - dLiLen2) * vtLiL:getX()
|
||||
local dLiTang2 = - dLiLen2 * vtLioL:getY()
|
||||
local dLiPerp2 = EgtIf( bRight, dLiLen2, - dLiLen2) * vtLioL:getX()
|
||||
if dLiLen2 < dLiLen then
|
||||
dLiTang = dLiTang2
|
||||
dLiPerp = dLiPerp2
|
||||
@@ -525,37 +539,37 @@ function FacesBySaw.CalcLeadInOutPerpGeom( ptP1, ptP2, vtV1, vtV2, vtN, dRad, vt
|
||||
-- Lunghezza di uscita
|
||||
local dLoTang = 10000
|
||||
local dLoPerp = 10000
|
||||
local bLoOk, _, vLoPar = EgtLineBoxInters( ptP2, vtLo, b3MyBox)
|
||||
local bLoOk, _, vLoPar = EgtLineBoxInters( ptP2, vtLio, b3MyBox)
|
||||
if bLoOk and #vLoPar > 0 then
|
||||
-- con la prima faccia di uscita
|
||||
local dLen = vLoPar[#vLoPar]
|
||||
local ptInt = ptP2 + vtLo * dLen
|
||||
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLo)
|
||||
local ptInt = ptP2 + vtLio * dLen
|
||||
local vtFN = BL.GetBoxFaceNorm( b3MyBox, ptInt, vtLio)
|
||||
EgtOutLog( 'LoFaceNorm=' .. tostring( vtFN), 3)
|
||||
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLo * vtFN)
|
||||
local dAddLen = dRad * ( sqrt( 1 - ( vtN * vtFN) * ( vtN * vtFN)) - abs( vtX * vtFN)) / ( vtLio * vtFN)
|
||||
local dLoLen = dLen + dAddLen
|
||||
EgtOutLog( 'LeadOut Dist=' .. EgtNumToString( dLoLen), 3)
|
||||
dLoTang = dLoLen * vtLoL:getY()
|
||||
dLoPerp = EgtIf( bRight, dLoLen, - dLoLen) * vtLoL:getX()
|
||||
dLoTang = dLoLen * vtLioL:getY()
|
||||
dLoPerp = EgtIf( bRight, dLoLen, - dLoLen) * vtLioL:getX()
|
||||
-- verifico se miglioro calcolando con faccia successiva
|
||||
local b3Mod = BBox3d( b3MyBox) ; b3Mod:Add( ptInt + 1000 * vtFN)
|
||||
local bLoOk2, _, vLoPar2 = EgtLineBoxInters( ptP2, vtLo, b3Mod)
|
||||
local bLoOk2, _, vLoPar2 = EgtLineBoxInters( ptP2, vtLio, b3Mod)
|
||||
if bLoOk2 and #vLoPar2 > 0 then
|
||||
local dLen2 = vLoPar2[#vLoPar2]
|
||||
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP2 + vtLo * dLen2, vtLo)
|
||||
local vtFN2 = BL.GetBoxFaceNorm( b3Mod, ptP2 + vtLio * dLen2, vtLio)
|
||||
EgtOutLog( 'LoFaceNorm2=' .. tostring( vtFN2), 3)
|
||||
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLo * vtFN2)
|
||||
local dAddLen2 = dRad * ( sqrt( 1 - ( vtN * vtFN2) * ( vtN * vtFN2)) - abs( vtX * vtFN2)) / ( vtLio * vtFN2)
|
||||
local dLoLen2 = dLen2 + dAddLen2
|
||||
EgtOutLog( 'LeadOut Dist2=' .. EgtNumToString( dLoLen2), 3)
|
||||
local dLoTang2 = dLoLen2 * vtLoL:getY()
|
||||
local dLoPerp2 = EgtIf( bRight, dLoLen2, - dLoLen2) * vtLoL:getX()
|
||||
local dLoTang2 = dLoLen2 * vtLioL:getY()
|
||||
local dLoPerp2 = EgtIf( bRight, dLoLen2, - dLoLen2) * vtLioL:getX()
|
||||
if dLoLen2 < dLoLen then
|
||||
dLoTang = dLoTang2
|
||||
dLoPerp = dLoPerp2
|
||||
end
|
||||
end
|
||||
end
|
||||
return dLiTang, dLiPerp, dLoTang, dLoPerp
|
||||
return dLiTang, dLiPerp, dLoTang, dLoPerp, vtLio
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
+34
-16
@@ -12,6 +12,11 @@
|
||||
-- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe).
|
||||
-- 2022/06/28 Modificata determinazione taglio bFromBottom in MakeFromTop.
|
||||
-- 2022/07/18 Se Q04=1, aggiunto LongCut anche dal lato per macchine tipo PF1250.
|
||||
-- 2022/08/12 I tagli di lama inclinati in coda ora partono dal centro e non dall'esterno.
|
||||
-- 2022/08/24 Disabilitato il dicing per i tagli meno spessi della lama.
|
||||
-- 2022/08/25 In caso di AdvTail con taglio lungo Y la profondità di lavorazione è opportunamente diminuita.
|
||||
-- 2022/08/30 Modificata la condizione che determina l'utilizzo della testa da sotto. Ora controlla se la trave è più grande del doppio della massima larghezza del cubetto.
|
||||
-- 2022/09/23 Corretta la condizione per cui è richiesto l'aggiornamento del grezzo.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessCut = {}
|
||||
@@ -245,17 +250,21 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
Proc.Box:getDimY() > b3Solid:getDimY() - 10 * GEO.EPS_SMALL and
|
||||
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
|
||||
-- verifico se da considerare taglio lungo dal lato, solo per macchine tipo PF1250, inclinato non più di 30deg
|
||||
local bLongCutFromSide = ( not bDownCut and ( BD.C_SIMM and BD.DOWN_HEAD and ( vtN:getY() > 0.865 or vtN:getY() < -0.865) and
|
||||
local bLongCutFromSide = ( not bDownCut and ( BD.C_SIMM and BD.DOWN_HEAD and ( abs(vtN:getY()) > 0.865) and
|
||||
Proc.Box:getDimZ() > b3Solid:getDimZ() - 10 * GEO.EPS_SMALL) and
|
||||
( Proc.Box:getDimX() > 0.75 * b3Solid:getDimX() or Proc.Box:getDimX() > 600.000))
|
||||
-- se taglio lungo e Q04 = 1 allora lancio il processo dell'L10
|
||||
local bNoDicing = EgtGetInfo( Proc.Id, 'Q04', 'i') == 1
|
||||
if bNoDicing then
|
||||
if bLongCut then
|
||||
return LongCut.Make( Proc, nPhase, nRawId, nPartId, true)
|
||||
local bOk, sErr = LongCut.Make( Proc, nPhase, nRawId, nPartId, true)
|
||||
return bOk, sErr, bNoDicing
|
||||
elseif bLongCutFromSide then
|
||||
return LongCut.Make( Proc, nPhase, nRawId, nPartId, false, 2)
|
||||
local bOk, sErr = LongCut.Make( Proc, nPhase, nRawId, nPartId, false, 2)
|
||||
return bOk, sErr, bNoDicing
|
||||
end
|
||||
-- se non passa dal LongCut rimetto a false perchè ha fatto un taglio standard
|
||||
bNoDicing = false
|
||||
end
|
||||
-- se pezzo ancora attaccato alla trave, per non rovinare quello successivo
|
||||
local bFillAreaPiece
|
||||
@@ -344,10 +353,13 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
vtExtra = X_AX()
|
||||
bAutoCalcSurf = false
|
||||
end
|
||||
vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
|
||||
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
|
||||
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
|
||||
-- se il taglio è più spesso della lama abilito il dicing, altrimenti no
|
||||
if Proc.Box:getDimX() >= dSawThick then
|
||||
vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA)
|
||||
-- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate
|
||||
if ( bFillTail or bCustDiceCut) and #vCuts == 0 then
|
||||
vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY())
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se il ProcessCut viene lanciato dal ProcessSawCut e non ci sono tagli a cubetti, esco
|
||||
@@ -423,7 +435,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
local dVzLimDwnUp = dNzLimDwnUp
|
||||
if j ~= 1 then
|
||||
vtNewOrthoO = -vtOrthoO
|
||||
if not BD.C_SIMM and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.707 end
|
||||
if not BD.C_SIMM and not BD.TURN and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.708 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
|
||||
@@ -447,7 +459,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
end
|
||||
end
|
||||
local dVzLimDwnUp = dNzLimDwnUp
|
||||
if not BD.C_SIMM and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end
|
||||
if not BD.C_SIMM and not BD.TURN 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, sNotes, b3Raw)
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
@@ -481,14 +493,17 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b
|
||||
else
|
||||
vtOrthoO = -X_AX()
|
||||
end
|
||||
elseif Proc.Head then
|
||||
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
|
||||
else
|
||||
if vtN:getZ() < dVzLimDwnUp then
|
||||
if vtN:getZ() < dVzLimDwnUp or Proc.Head or Proc.Tail then
|
||||
vtOrthoO = EgtIf( vtN:getY() > -0.02, -Y_AX(), Y_AX())
|
||||
else
|
||||
vtOrthoO = EgtIf( vtN:getY() > 0.02, Y_AX(), -Y_AX())
|
||||
end
|
||||
-- se è una lavorazione da anticipare diminuisco la profondità del taglio per evitare collisioni con l'albero della lama
|
||||
if Proc.AdvTail then
|
||||
local _, dH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
dCutExtra = min( -BD.ADVANCE_TAIL_OFFS, -dH + dMaxDepth)
|
||||
end
|
||||
end
|
||||
-- taglio
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
@@ -713,9 +728,9 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
||||
return true
|
||||
end
|
||||
end
|
||||
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione larga o pezzo corto)
|
||||
-- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg e sbandato oltre 1deg oppure sezione più larga di 2 cubetti o pezzo corto)
|
||||
local bDownHead = ( BD.DOWN_HEAD and vtN:getZ() < -0.341 and
|
||||
( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_HTCUT - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART))
|
||||
( abs( vtN:getY()) > 0.017 or b3Raw:getDimY() > 2 * ( BD.MAX_DIM_DICE - BD.CUT_EXTRA_MIN) or b3Raw:getDimX() < BD.LEN_SHORT_PART))
|
||||
local bDownTurn = ( BD.TURN and vtN:getZ() < -0.017)
|
||||
local bTopHead = ( BD.DOWN_HEAD and ( vtN:getZ() > -0.342 or not bDownHead))
|
||||
-- recupero la lavorazione
|
||||
@@ -727,9 +742,11 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local bNoDicing = false
|
||||
-- se taglio con testa da sopra
|
||||
if not bDownHead and not bDownTurn then
|
||||
local bOk, sErr = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
|
||||
local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes)
|
||||
bNoDicing = bNoDicing2
|
||||
if not bOk then return false, sErr end
|
||||
-- altrimenti taglio con testa da sotto
|
||||
else
|
||||
@@ -737,7 +754,8 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom,
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- Aggiornamento ingombro (se vero taglio o richiesto)
|
||||
if ProcessCut.Identify( Proc) or bUpdateIng then
|
||||
-- Se lascio il cordolo (bNoDicing) non aggiorno il grezzo perchè lo scarto rimane attaccato
|
||||
if ( ProcessCut.Identify( Proc) or bUpdateIng) and not bNoDicing then
|
||||
UpdateEncumbrance( Proc, vtN, dOvmHead, nRawId, b3Solid, b3Raw)
|
||||
end
|
||||
return true
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
-- ProcessDoubleCut.lua by Egaltech s.r.l. 2022/07/11
|
||||
-- Gestione calcolo doppi tagli di lama per Travi
|
||||
-- 2022/08/29 Implementata la fresatura dal lato per tagli problematici per PF1250
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessDoubleCut = {}
|
||||
@@ -188,6 +189,293 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster, bPocketDown)
|
||||
-- tipo di svuotatura
|
||||
local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket')
|
||||
-- ricerca della svuotatura
|
||||
local sPocketing
|
||||
if dDepth then
|
||||
sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||
ML.FindPocketing( sMchFind, dDiam, 0.8 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||
ML.FindPocketing( sMchFind, dDiam, 0.6 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||
ML.FindPocketing( sMchFind, dDiam, 0.4 * dDepth, dMaxTotLen, not bPocketDown, bPocketDown) or
|
||||
ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
|
||||
else
|
||||
sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen)
|
||||
end
|
||||
if not sPocketing then
|
||||
return false
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
local bUsePocketing = false
|
||||
local dMaxDepth = 0
|
||||
local dToolDiam = 0
|
||||
if EgtMdbSetCurrMachining( sPocketing) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
bUsePocketing = true
|
||||
end
|
||||
return bUsePocketing, sPocketing, dMaxDepth, dToolDiam
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId)
|
||||
-- fondo tra loro le curve compatibili
|
||||
EgtMergeCurvesInCurveCompo( nPathInt)
|
||||
local nStartIdEnt, nNumEnt = EgtCurveDomain( nPathInt)
|
||||
local pLastPIni, pLastPEnd
|
||||
-- faccio una copia della curva e la esplodo
|
||||
if nStartIdEnt then
|
||||
-- ciclo i lati della curva e controllo per ognuno se giace in uno dei piani limite del pezzo: se sì allora il lato è aperto
|
||||
for i = 1, nNumEnt do
|
||||
local pPini = EgtUP( nPathInt, (i-1), GDB_RT.GLOB)
|
||||
local pPend = EgtUP( nPathInt, EgtIf( i == nNumEnt, 0, i), GDB_RT.GLOB)
|
||||
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
|
||||
-- scrivo nelle proprietà della curva quali sono i lati aperti
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
-- se ci sono già altri lati aperti
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
-- se è l'unico
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeBySidePocket( Proc, nPhase, nRawId, nPartId, nAddGrpId, b3Solid)
|
||||
local nFirstMachId
|
||||
local sWarn
|
||||
local sMchFind = 'OpenPocket'
|
||||
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt
|
||||
local bBadMach = false
|
||||
-- ottengo le dimensioni del tunnel
|
||||
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
|
||||
-- posso utilizzare utensile con diametro doppio della dimensione minima
|
||||
dDimMin = min( 2 * dDimMin, BD.MAXDIAM_POCK_CORNER)
|
||||
local nPathInt
|
||||
-- verifico se è presente la testa da sotto e se è necessario usarla
|
||||
bMillDown = ( BD.DOWN_HEAD == true and abs( vtOrtho:getZ()) >= 0.707)
|
||||
-- cerco l'utensile di svuotatura per la testa sopra
|
||||
local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind)
|
||||
local bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn
|
||||
-- cerco anche l'utensile per la testa sotto, nel caso servisse
|
||||
if bMillDown then
|
||||
bMakePocketDn, sPocketingDn, dMaxDepthDn, dDiamToolDn = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind, true)
|
||||
-- se è negativo inverto il versore e la faccia
|
||||
if vtOrtho:getZ() < 0 then
|
||||
vtOrtho = -vtOrtho
|
||||
EgtInvertSurf( nSurfInt)
|
||||
end
|
||||
end
|
||||
if bMakePocket then
|
||||
-- gestione svuotatura da un solo lato o anche dal lato opposto (se non verticale)
|
||||
-- estraggo il contorno dalla superfice per evitare i problemi con la svuotatura
|
||||
-- e assegno l'estrusione
|
||||
nPathInt = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId)
|
||||
EgtModifyCurveExtrusion( nPathInt, vtOrtho, GDB_RT.GLOB)
|
||||
SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId)
|
||||
-- variabili per parametri lavorazione
|
||||
local dMachDepth
|
||||
local dElev = 0
|
||||
local bDoubleSide
|
||||
local bOneShot
|
||||
local bComplete = true
|
||||
-- imposto altezza aggiuntiva di elevazione
|
||||
local dCollSic = BL.CalcCollisionSafety( vtOrtho)
|
||||
-- se possibile svuotare completamente da una sola parte
|
||||
if dMaxDepth > ( dDepth + BD.CUT_EXTRA + dCollSic) then
|
||||
dMachDepth = ( dDepth / 2) + BD.CUT_EXTRA
|
||||
dElev = dDepth + BD.CUT_EXTRA
|
||||
bOneShot = true
|
||||
else
|
||||
-- se direzione verso la verticale setto max affondamento possibile ed
|
||||
-- emetto messaggio di warning perché non lavorabile interamente
|
||||
if abs( vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
|
||||
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
|
||||
dElev = dMaxDepth
|
||||
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
bComplete = false
|
||||
-- altrimenti setto il flag per fare la svuotatura da due parti
|
||||
else
|
||||
-- se l'altezza utensile riesce a lavorare completamente da due parti
|
||||
if dMaxDepth > ( dDepth / 2) + dCollSic + BD.CUT_EXTRA_MIN then
|
||||
dMachDepth = BD.CUT_EXTRA_MIN
|
||||
dElev = ( dDepth / 2) + BD.CUT_EXTRA_MIN
|
||||
-- altrimenti non si riesce in due passate, limito la profondità e setto l'elevazione
|
||||
else
|
||||
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
|
||||
dElev = dMaxDepth
|
||||
-- se molto inclinato rispetto alla normale della faccia di riferimento, lavorazione non idonea per probabili collisioni
|
||||
local vtRef = Y_AX()
|
||||
if abs( vtOrtho:getX()) > abs( vtOrtho:getY()) and abs( vtOrtho:getX()) > abs( vtOrtho:getZ()) then
|
||||
vtRef = X_AX()
|
||||
elseif abs( vtOrtho:getZ()) > abs( vtOrtho:getX()) and abs( vtOrtho:getZ()) > abs( vtOrtho:getY()) then
|
||||
vtRef = Z_AX()
|
||||
end
|
||||
if abs( vtOrtho * vtRef) < 0.5 then
|
||||
bBadMach = true
|
||||
end
|
||||
end
|
||||
bDoubleSide = true
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, sPocketing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
|
||||
EgtOutLog( sErr)
|
||||
return -1, sErr
|
||||
end
|
||||
-- prendo l'id della prima lavorazione inserita
|
||||
if not nFirstMachId then
|
||||
nFirstMachId = nMchFId
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nPathInt, -1}})
|
||||
-- verifico se devo invertire direzione utensile (in caso di direzione verso la verticale)
|
||||
local bInvertMach
|
||||
if vtOrtho:getZ() < BD.NZ_MINA and abs(vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
bInvertMach = true
|
||||
-- altrimenti se da fare in una sola volta e direzionato verso Y+ lo inverto per lavorarlo davanti
|
||||
elseif not bDoubleSide and vtOrtho:getY() > GEO.EPS_SMALL and not ( -(vtOrtho:getZ()) < BD.NZ_MINA) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
bInvertMach = true
|
||||
end
|
||||
-- imposto posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM then
|
||||
if AreSameOrOppositeVectorApprox( vtOrtho, Z_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
elseif abs( vtOrtho:getX()) < 0.1 then
|
||||
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||
elseif vtOrtho:getY() < GEO.EPS_SMALL then
|
||||
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
||||
else
|
||||
nSCC = EgtIf( bInvertMach, MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||
-- inverto il percorso di lavorazione per lavorare sinistro
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
-- imposto affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
|
||||
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
|
||||
sNotes = sNotes .. 'VMRS=0;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
-- provo ad allargare leggermente la tasca
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return -1, sErr
|
||||
end
|
||||
end
|
||||
-- se posso applicare la svuotatura sul lato opposto
|
||||
if bDoubleSide then
|
||||
-- se ho la lavorazione da sotto ricalcolo in base a questa lavorazione
|
||||
if bMakePocketDn then
|
||||
-- sPocketing = sPocketingDn
|
||||
-- dMaxDepth = dMaxDepthDn
|
||||
-- dDiamTool = dDiamToolDn
|
||||
-- se l'altezza utensile riesce a lavorare completamente da due parti
|
||||
if dMaxDepthDn > ( dDepth / 2) + dCollSic + BD.CUT_EXTRA_MIN then
|
||||
dMachDepth = BD.CUT_EXTRA_MIN
|
||||
dElev = ( dDepth / 2) + BD.CUT_EXTRA_MIN
|
||||
-- altrimenti non si riesce in due passate, limito la profondità e setto l'elevazione
|
||||
else
|
||||
dMachDepth = dMaxDepthDn - ( dDepth / 2) - dCollSic
|
||||
dElev = dMaxDepthDn
|
||||
bComplete = false
|
||||
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
else
|
||||
-- se anche lavorando dal lato opposto non riesco a svuotare completamente la fessura
|
||||
-- setto i parametri affondamento ed emetto warning
|
||||
if dMaxDepth < ( dDepth / 2) + BD.CUT_EXTRA + dCollSic then
|
||||
dMachDepth = dMaxDepth - (dDepth / 2) - dCollSic
|
||||
dElev = dMaxDepth
|
||||
bComplete = false
|
||||
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
local sName = 'PockOppo_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, EgtIf( bMakePocketDn, sPocketingDn, sPocketing))
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. EgtIf( bMakePocketDn, sPocketingDn, sPocketing)
|
||||
EgtOutLog( sErr)
|
||||
return -1, sErr
|
||||
end
|
||||
-- prendo l'id della prima lavorazione inserita
|
||||
if not nFirstMachId then
|
||||
nFirstMachId = nMchFId
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nPathInt, -1}})
|
||||
-- imposto direzione utensile opposta
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
-- imposto posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if not BD.C_SIMM then
|
||||
if AreSameVectorApprox( vtOrtho, Z_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
elseif abs( vtOrtho:getX()) < 0.1 then
|
||||
nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
||||
elseif vtOrtho:getY() < GEO.EPS_SMALL then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
else
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
end
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||
-- inverto il percorso di lavorazione per lavorare sinistro
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
-- imposo affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
|
||||
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
|
||||
sNotes = sNotes .. 'VMRS=0;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
-- provo ad allargare leggermente la tasca
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, -0.1)
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return -1, sErr
|
||||
end
|
||||
end
|
||||
end
|
||||
return 1, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId
|
||||
end
|
||||
return 0, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId, bOrthoFaces
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
@@ -273,6 +561,31 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- eseguo
|
||||
local sCutType = EgtIf( bHead, 'HeadSide', 'TailSide')
|
||||
local bDownHead = ( BD.DOWN_HEAD and vtNm:getZ() < BD.NZ_MINB)
|
||||
-- per tutte le macchine tranne la Fast, controllo se ci sono tagli troppo inclinati e troppo profondi per la lama
|
||||
-- in tal caso richiamo la lavorazione con fresa dal lato
|
||||
if BD.C_SIMM and not bDownHead then
|
||||
local sCutting = ML.FindCutting( sCutType, nil, bDownHead)
|
||||
if not sCutting then
|
||||
local sErr = 'Error : cutting not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
local dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sCutting) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
local _, _, dDimV1 = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw)
|
||||
local _, _, dDimV2 = BL.GetFaceHvRefDim( Proc.Id, 1, b3Raw)
|
||||
local bFace1TooLongForBlade, bFace2TooLongForBlade = ( dDimV1 >= dMaxDepth), ( dDimV2 >= dMaxDepth)
|
||||
local dFace1Ang, dFace2Ang = vtN[1]:getZ(), vtN[2]:getZ()
|
||||
if bFace1TooLongForBlade and dFace1Ang < ( BD.CUT_VZ_MIN or -0.484) or bFace2TooLongForBlade and dFace2Ang < ( BD.CUT_VZ_MIN or -0.484) then
|
||||
local bOk, sErr = MakeBySidePocket( Proc, nPhase, nRawId, nPartId, nAddGrpId, b3Solid)
|
||||
return bOk, sErr
|
||||
end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, false, bDownHead)
|
||||
if not bOk then return bOk, sErr end
|
||||
-- segnalazione ingombro di testa o coda
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessDrill.lua by Egaltech s.r.l. 2022/04/21
|
||||
-- ProcessDrill.lua by Egaltech s.r.l. 2022/08/18
|
||||
-- Gestione calcolo forature per Travi
|
||||
-- 2021/04/14 DS Corretta gestione Invert con testa da sotto. Migliorato calcolo ingombro portautensile.
|
||||
-- 2021/05/03 DS Su macchina con testa da sotto aggiunta possibilità di fare fori verticali metà sopra e l'altra sotto.
|
||||
@@ -12,6 +12,7 @@
|
||||
-- 2022/07/07 Aggiunta la gestione delle forature migliorate in presenza di feature testa/coda che tagliano tutta la sezione; gli Id delle feature sono nelle proprietà MachineAfterHeadCutId e MachineAfterTailCutId.
|
||||
-- 2022/07/12 Aggiunto un valore minimo (10) per la distanza di sicurezza.
|
||||
-- 2022/07/27 Aggiunta la gestione del tipo di foratura "AngleDrill" per fori molto inclinati
|
||||
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto e punta disabilitata.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessDrill = {}
|
||||
@@ -231,15 +232,17 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
vtExtr = - vtExtr
|
||||
end
|
||||
local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0)
|
||||
-- verifico possibilità di foratura da sotto
|
||||
local bDownDrill = ( BD.DOWN_HEAD and ML.FindDrilling( dDiam, nil, false, true))
|
||||
-- verifico che il foro non sia fattibile solo da sotto
|
||||
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not BD.DOWN_HEAD)
|
||||
local bToInvert = ( vtExtr:getZ() < BD.DRILL_VZ_MIN and not bDownDrill)
|
||||
if bToInvert and ( not bOpen or Proc.Flg ~= 1) then
|
||||
local sErr = 'Error : drilling from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- se non già richiesta inversione e invertibile
|
||||
if not bToInvert and Proc.Flg == 1 and ( -vtExtr:getZ() >= BD.DRILL_VZ_MIN or BD.DOWN_HEAD) then
|
||||
if not bToInvert and Proc.Flg == 1 and ( -vtExtr:getZ() >= BD.DRILL_VZ_MIN or bDownDrill) then
|
||||
-- se il foro è cieco o troppo inclinato all'inizio, lo inverto
|
||||
local _, CosB, _ = GetHoleStartData( ptCen, vtExtr, b3Solid)
|
||||
if Proc.Fcs == 0 or ( CosB > BD.DRILL_VX_MAX and bOpen) then
|
||||
@@ -262,8 +265,8 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
local dCheckDepth2 = dDepth2
|
||||
local nErrorCode = 0
|
||||
-- abilitazione foratura da sotto
|
||||
local bDrillDown = ( BD.DOWN_HEAD and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259))
|
||||
local bDrillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.5)
|
||||
local bDrillDown = ( bDownDrill and ( Proc.Down or vtExtr:getZ() < -0.1 or vtExtr:getZ() < 0.259))
|
||||
local bDrillUp = ( bDownDrill and vtExtr:getZ() > -0.5)
|
||||
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
|
||||
-- recupero la lavorazione
|
||||
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown)
|
||||
@@ -479,7 +482,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
-- eseguo
|
||||
local bOk = ML.ApplyMachining( true, false)
|
||||
if not bOk and BD.DOWN_HEAD then
|
||||
if not bOk and bDownDrill then
|
||||
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/06/07
|
||||
-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/08/18
|
||||
-- Gestione calcolo mortase a coda di rondine per Travi
|
||||
-- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa.
|
||||
-- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto.
|
||||
@@ -6,6 +6,7 @@
|
||||
-- 2021/07/20 Aggiunta gestione rinvio angolare su FAST.
|
||||
-- 2021/12/01 Se frontale aggiungo taglio con Grp e Proc di vero taglio (per aggiornare ingombro di testa /coda).
|
||||
-- 2022/06/01 Modifiche per evitare di entrare nel legno con mortase parziali.
|
||||
-- 2022/08/18 Migliorato calcolo dello step.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessDtMortise = {}
|
||||
@@ -430,7 +431,8 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local dDist = min( vtOrtDiff:len(), dWidthMrt)
|
||||
-- calcolo le passate
|
||||
local nPass = ceil( dDist / ( 1.9 * dToolDiam))
|
||||
local dStep = ( dDist - 0.95 * dToolDiam) / ( 2 * nPass)
|
||||
local dStep = 0
|
||||
if nPass > 1 then dStep = max( ( dDist - 2 * dToolDiam) / ( 2 * nPass - 2), 0.25 * dToolDiam) end
|
||||
for i = nPass, 1, -1 do
|
||||
-- inserisco la lavorazione di contornatura
|
||||
local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/10/07
|
||||
-- Gestione calcolo profilo libero per Travi
|
||||
-- 2022/08/23 Aggiunta la funzione MakeByMark per la gestione del caso P13=10
|
||||
-- 2022/09/21 In MakeByMill aggiunto messaggio per elevazione non raggiunta
|
||||
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessFreeContour = {}
|
||||
@@ -233,14 +236,16 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local dDepth = abs( EgtCurveThickness( AuxId))
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
local b3Aux = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD)
|
||||
local bToolInv = ( vtExtr:getZ() < -0.1)
|
||||
local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
|
||||
local bDown = ( b3Aux:getMin():getZ() < b3Raw:getMin():getZ() + 5)
|
||||
-- verifico se in testa o coda
|
||||
local bHead = Proc.Head
|
||||
-- verifico i parametri Q per profondità smusso e per eseguirlo in esclusiva
|
||||
local nChamfer, dDepthCham, sChamfer = VerifyChamfer( Proc, AuxId, nRawId, true)
|
||||
-- recupero la lavorazione
|
||||
local sMilling = ML.FindMilling( 'FreeContour')
|
||||
-- recupero la lavorazione
|
||||
local bTopHead = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.1)
|
||||
local bDownHead = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
||||
local sMilling = ML.FindMilling( 'FreeContour', nil, nil, nil, nil, bTopHead, bDownHead)
|
||||
if not sMilling then
|
||||
local sErr = 'Error : FreeContour not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -310,6 +315,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
dDepth = dDepth + BD.CUT_EXTRA
|
||||
end
|
||||
end
|
||||
local bIsDepthReduced = false
|
||||
-- se parametro beamdata forza codolo in centro e lavorazione orizzontale e se larghezza trave è sufficientemente larga
|
||||
if BD.DIM_TO_CENTER_STRIP and BD.DIM_TO_CENTER_STRIP > 10 * GEO.EPS_SMALL and nStep > 1 and
|
||||
bCanDouble and b3Raw:getDimY() > BD.DIM_TO_CENTER_STRIP - 0.1 then
|
||||
@@ -321,11 +327,21 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
if bCanDouble then
|
||||
nDouble = 2
|
||||
dDepth = min( 0.5 * dDepth, dMaxDepth)
|
||||
if dDepth < 0.5 * dDepth - 10 * GEO.EPS_SMALL then
|
||||
bIsDepthReduced = true
|
||||
end
|
||||
else
|
||||
dDepth = dMaxDepth
|
||||
bIsDepthReduced = true
|
||||
end
|
||||
end
|
||||
end
|
||||
local sWarn = ''
|
||||
-- se ho ridotto l'altezza emetto warning
|
||||
if bIsDepthReduced then
|
||||
sWarn = 'Warning in process ' .. tostring( Proc.Id) .. ' (Free Contour) : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
-- se utensile orizzontale verso Y+, non in doppio e codolo da lasciare, devo invertire per lavorare sempre da Y-
|
||||
if vtExtr:getY() > 0.707 and nDouble == 1 and bStripOnSide then
|
||||
bToolInv = true
|
||||
@@ -620,7 +636,7 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
BL.UpdateTCING( nRawId, dOffs)
|
||||
end
|
||||
end
|
||||
return true
|
||||
return true, sWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -688,6 +704,76 @@ local function MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeByMark( Proc, nRawId, b3Raw, nPartId)
|
||||
-- ingombro del pezzo
|
||||
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
|
||||
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
if not b3Solid then
|
||||
local sErr = 'Error : part box not found'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero e verifico l'entità curva
|
||||
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
|
||||
if AuxId then AuxId = AuxId + Proc.Id end
|
||||
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
|
||||
local sErr = 'Error : missing profile geometry'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati della curva e del profilo
|
||||
local dDepth = abs( EgtCurveThickness( AuxId))
|
||||
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
|
||||
local bToolInv = ( vtExtr:getZ() < -0.1 and b3Aux:getDimZ() > b3Raw:getDimZ() - 5)
|
||||
-- verifico che la marcatura non sia orientata verso il basso (-5 deg)
|
||||
if vtExtr:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Mark from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- abilitazione lavorazione da sotto
|
||||
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
||||
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.174)
|
||||
-- recupero la lavorazione
|
||||
local sMillType = 'Text'
|
||||
--local sMchExt = EgtIf( bMillDown, '_H2', '')
|
||||
local sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown)
|
||||
if not sMilling then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' milling not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- inserisco la lavorazione
|
||||
local sName = 'FreeMark_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
EgtSetInfo( nMchId, 'Part', Proc.PartId)
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ AuxId, -1}})
|
||||
-- se estrusione da sotto, inverto direzione fresa
|
||||
if bToolInv then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
end
|
||||
-- posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.ADIR_ZP
|
||||
if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
|
||||
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchId, false)
|
||||
return false, sErr
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
@@ -698,7 +784,15 @@ function ProcessFreeContour.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
return MakeByPocket( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- altrimenti contornatura
|
||||
else
|
||||
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- recupero il tipo di lavorazione
|
||||
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
|
||||
-- se marcatura
|
||||
if nCntType == 10 then
|
||||
return MakeByMark( Proc, nRawId, b3Raw, nPartId)
|
||||
-- se fresatura
|
||||
else
|
||||
return MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+89
-79
@@ -1,7 +1,10 @@
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2022/07/25
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2022/09/26
|
||||
-- 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.
|
||||
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
|
||||
-- 2022/09/08 Migliorato verso di lavorazione in caso di DoubleCut
|
||||
-- 2022/09/26 Gestione dei tagli di lama (Horiz, double, etc.) estesa anche a BigSection
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessHeadCut = {}
|
||||
@@ -173,13 +176,25 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
end
|
||||
end
|
||||
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
||||
-- recupero la eventuale lavorazione con lama da sotto
|
||||
local sCutting2 = ML.FindCutting( 'HeadSide_H2', false, true)
|
||||
-- recupero i dati della eventuale seconda lama
|
||||
local dSawDiam2 = 0
|
||||
local dMaxDepth2 = 0
|
||||
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
|
||||
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
|
||||
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
|
||||
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
|
||||
end
|
||||
end
|
||||
-- caratteristiche taglio
|
||||
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
|
||||
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
|
||||
( b3Raw:getDimZ() > EgtIf( BD.DOWN_HEAD or BD.TURN, 2, 1) * dMaxVertDepth - 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)
|
||||
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA)
|
||||
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||
-- 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
|
||||
@@ -189,15 +204,16 @@ 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
|
||||
local bFinishByBlade = not bBigSectionCut
|
||||
-- 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
|
||||
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
|
||||
-- se finitura con lama rimando ai casi standard
|
||||
if nQ05 == 1 or nQ05 == 0 then
|
||||
bFinishByBlade = true
|
||||
-- se finitura con truciolatore
|
||||
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
|
||||
elseif nQ05 == 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'
|
||||
@@ -214,82 +230,76 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut
|
||||
if not bOk then return bOk, sErr end
|
||||
end
|
||||
end
|
||||
-- se tagli standard
|
||||
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
|
||||
local dCutExtra = 0
|
||||
local dAccStart = 0
|
||||
local dAccEnd = 0
|
||||
if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
|
||||
dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
|
||||
else
|
||||
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
|
||||
local dSawRad = dSawDiam / 2
|
||||
local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN
|
||||
if BD.C_SIMM then
|
||||
dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||
end
|
||||
-- tagli standard con lama
|
||||
if bFinishByBlade then
|
||||
if 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
|
||||
local dCutExtra = 0
|
||||
local dAccStart = 0
|
||||
local dAccEnd = 0
|
||||
if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
|
||||
dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
|
||||
else
|
||||
dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
|
||||
local dSawRad = dSawDiam / 2
|
||||
local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN
|
||||
if BD.C_SIMM then
|
||||
dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||
else
|
||||
dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se necessari tagli in doppio, eseguo gli opposti
|
||||
if bDoubleCut then
|
||||
-- se necessari tagli in doppio, eseguo gli opposti
|
||||
if bDoubleCut then
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
-- eseguo i tagli necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw)
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
-- eseguo i tagli necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
|
||||
else
|
||||
-- recupero la lavorazione con lama da sotto
|
||||
local sCutting2 = ML.FindCutting( 'HeadSide_H2', false, true)
|
||||
if not sCutting2 then
|
||||
local sErr = 'Error : cutting H2 not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati della seconda lama
|
||||
local dSawDiam2 = 400
|
||||
local dMaxDepth2 = 50
|
||||
if EgtMdbSetCurrMachining( sCutting2) then
|
||||
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
|
||||
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
|
||||
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
|
||||
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
|
||||
else
|
||||
-- verifico esistenza della lavorazione con lama da sotto
|
||||
if not sCutting2 then
|
||||
local sErr = 'Error : cutting H2 not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico che le due lame riescano a lavorare la sezione
|
||||
local dDimZ = b3Raw:getDimZ()
|
||||
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
|
||||
if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then
|
||||
local sErr = 'Error : section too big for head cut'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dAccStart = 0
|
||||
local dVzLimDwnUp
|
||||
if BD.TURN then dVzLimDwnUp = -2 end
|
||||
-- eseguo i tagli da sotto necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- eseguo i tagli da sopra necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
-- verifico che le due lame riescano a lavorare la sezione
|
||||
local dDimZ = b3Raw:getDimZ()
|
||||
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
|
||||
if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then
|
||||
local sErr = 'Error : section too big for head cut'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dAccStart = 0
|
||||
-- eseguo i tagli da sotto necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, nil, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- eseguo i tagli da sopra necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
||||
+314
-356
@@ -49,6 +49,11 @@
|
||||
-- 2022/06/29 Migliorate lavorazioni con fresatura di lato per L30 se parametro Q03=2. Ora con 4 facce / 3 facce a L può entrare una fresa grande fino al doppio dell'altezza della tasca / doppio della dimensione minima.
|
||||
-- 2022/07/05 Modifiche per sega a catena di testa e relativa MaxElev.
|
||||
-- 2022/07/12 In MakeByChainOrSaw aggiunto check per feature L20 usata in modo improprio e, nel caso, si passa a una lavorazione tasca.
|
||||
-- 2022/08/11 Aggiunta lavorazione tunnel splittata con sega a catena per tutte le macchine ad esclusione della Fast.
|
||||
-- 2022/09/01 Spostate le funzioni GetTunnelDimension, CalcCollisionSafety, SetOpenSide in BeamLib.
|
||||
-- 2022/09/15 Implementata gestione feature Planing L090, gestita come LapJoint
|
||||
-- Implementata, in caso di fresatura di lato con altezza tasca molto bassa, la contornatura con unica passata
|
||||
-- Migliorata gestione AntiSplint (Mill e Saw)
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessLapJoint = {}
|
||||
@@ -99,6 +104,7 @@ function ProcessLapJoint.Identify( Proc)
|
||||
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32) or
|
||||
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 33) or
|
||||
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 34) or
|
||||
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 90) or
|
||||
( Proc.Grp == 4 and Proc.Prc == 37) or
|
||||
( Proc.Grp == 4 and Proc.Prc == 39) or
|
||||
( Proc.Grp == 4 and Proc.Prc == 120))
|
||||
@@ -156,6 +162,9 @@ local function AssignQIdent( Proc)
|
||||
Q_CONTOUR_SMALL_TOOL = 'Q01' -- i
|
||||
Q_USE_MILL = 'Q02' -- i
|
||||
Q_ANTISPLINT_TYPE = 'Q06' -- i
|
||||
elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 90 then
|
||||
Q_ANTISPLINT_TYPE = 'Q03' -- i
|
||||
Q_SIDE_ROUGH_TOOL = 'Q04' -- i
|
||||
end
|
||||
-- le altre features gestite non hanno parametri Q
|
||||
end
|
||||
@@ -443,62 +452,6 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
|
||||
return bUseBHSideMill, bHead, bHeadDir, sMilling, dToolThick, dToolDiam
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetTunnelDimension( Proc, nPartId)
|
||||
-- sono necessarie almeno due facce
|
||||
if Proc.Fct < 2 then return 0, 0, 0 end
|
||||
-- recupero l'ingombro della trave
|
||||
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
-- recupero centro e normale delle facce
|
||||
local ptC = {}
|
||||
local vtN = {}
|
||||
for i = 1, Proc.Fct do
|
||||
ptC[i], vtN[i] = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
|
||||
end
|
||||
-- calcolo l'orientamento del tunnel
|
||||
local vtOrtho
|
||||
local bAdj = EgtSurfTmFacetsContact( Proc.Id, 0, 1)
|
||||
if bAdj then
|
||||
vtOrtho = vtN[1] ^ vtN[2]
|
||||
else
|
||||
if Proc.Fct >= 3 then
|
||||
vtOrtho = vtN[1] ^ vtN[3]
|
||||
else
|
||||
return 0, 0, 0
|
||||
end
|
||||
end
|
||||
-- ottengo il boundingBox e prendo le dimensioni lungo la direzione (Z locale) che rappresenta la profondità della fessura
|
||||
local frFc = Frame3d( ptC[1], vtOrtho) ;
|
||||
local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc)
|
||||
local dDepth = b3BoxLoc:getDimZ()
|
||||
-- recupero gruppo per geometria addizionale
|
||||
local nAddGrpId = BL.GetAddGroup( nPartId)
|
||||
if not nAddGrpId then
|
||||
EgtOutLog( 'Error : missing AddGroup')
|
||||
return 0, 0, 0
|
||||
end
|
||||
-- centro del bounding box locale
|
||||
local ptCen = b3BoxLoc:getCenter()
|
||||
ptCen:toGlob( frFc)
|
||||
-- creo superficie intermedia
|
||||
local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, ptCen, vtOrtho, b3Solid, GDB_ID.ROOT)
|
||||
if not nSurfInt then return 0, 0, 0 end
|
||||
-- ritaglio la superficie con le facce della fessura
|
||||
for i = 1, Proc.Fct do
|
||||
EgtCutSurfTmPlane( nSurfInt, ptC[i], -vtN[i], false, GDB_ID.ROOT)
|
||||
end
|
||||
local frSurfInt, dDimMax, dDimMin = EgtSurfTmFacetMinAreaRectangle( nSurfInt, 0, GDB_ID.ROOT)
|
||||
-- cerco la faccia con larghezza pari a dimensione massima della fessura
|
||||
local nLongIdFace = 0
|
||||
for i = 1, Proc.Fct do
|
||||
if abs( vtN[i] * frSurfInt:getVersX()) < 0.5 then
|
||||
nLongIdFace = i - 1
|
||||
break
|
||||
end
|
||||
end
|
||||
return dDimMin, dDimMax, dDepth, vtOrtho, nLongIdFace, nSurfInt
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetFaceAdj( Proc, nFacInd, dH, dV)
|
||||
|
||||
@@ -533,23 +486,6 @@ local function GetFaceAdj( Proc, nFacInd, dH, dV)
|
||||
return nFacAdj
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function CalcCollisionSafety( vtDir)
|
||||
local dCollSic = 10 * BD.COLL_SIC
|
||||
if abs( vtDir:getX()) > 0.999 or abs( vtDir:getY()) > 0.999 or abs( vtDir:getZ()) > 0.999 then
|
||||
dCollSic = 0
|
||||
elseif abs( vtDir:getX()) > 0.996 or abs( vtDir:getY()) > 0.996 or abs( vtDir:getZ()) > 0.996 then
|
||||
dCollSic = 1 * BD.COLL_SIC
|
||||
elseif abs( vtDir:getX()) > 0.89 or abs( vtDir:getY()) > 0.89 or abs( vtDir:getZ()) > 0.89 then
|
||||
dCollSic = 2.5 * BD.COLL_SIC
|
||||
elseif abs( vtDir:getX()) > 0.86 or abs( vtDir:getY()) > 0.86 or abs( vtDir:getZ()) > 0.86 then
|
||||
dCollSic = 4 * BD.COLL_SIC
|
||||
elseif abs( vtDir:getX()) > 0.707 or abs( vtDir:getY()) > 0.707 or abs( vtDir:getZ()) > 0.707 then
|
||||
dCollSic = 5.5 * BD.COLL_SIC
|
||||
end
|
||||
return dCollSic
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function UpdateEncumbrance( Proc, nRawId, b3Raw, b3Solid)
|
||||
-- verifico siano una o due facce
|
||||
@@ -757,7 +693,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw)
|
||||
-- se facce formano un tunnel e sono ortogonali
|
||||
if bClosedOrthoFaces then
|
||||
-- ottengo le dimensioni del tunnel
|
||||
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId)
|
||||
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
|
||||
EgtErase( nSurfInt)
|
||||
-- verifico se può essere fatto con svuotatura
|
||||
if VerifyPocket( Proc, dDimMin) then
|
||||
@@ -1322,165 +1258,6 @@ local function CheckToInvert( AuxId, bPositive)
|
||||
return false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId, nStartPoint)
|
||||
|
||||
-- fondo tra loro le curve compatibili
|
||||
EgtMergeCurvesInCurveCompo( nPathInt)
|
||||
local nStartIdEnt, nNumEnt = EgtCurveDomain( nPathInt)
|
||||
local pLastPIni, pLastPEnd
|
||||
|
||||
-- faccio una copia della curva e la esplodo
|
||||
if nStartIdEnt then
|
||||
-- prendo i punti
|
||||
for i = 1, nNumEnt do
|
||||
local pPini = EgtUP( nPathInt, (i-1), GDB_RT.GLOB)
|
||||
local pPend = EgtUP( nPathInt, EgtIf( i == nNumEnt, 0, i), GDB_RT.GLOB)
|
||||
-- Se normale lungo la Z considero il box in X e Y
|
||||
if abs(vtOrtho:getZ()) > 0.999 then
|
||||
-- se corrisponde a X
|
||||
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
-- altrimenti se corrisponde a Y
|
||||
elseif ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
end
|
||||
-- altrimenti se normale lungo la Y considero il box in X e Z
|
||||
elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getY()) > 0.999 then
|
||||
-- se corrisponde a X
|
||||
if ( abs( pPini:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMax():getX()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL and abs( pPend:getX() - b3Solid:getMin():getX()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
-- altrimenti se corrisponde a Z
|
||||
elseif ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
end
|
||||
-- caso che non dovrebbe mai capitare ma gestito per completezza
|
||||
-- altrimenti se normale lungo la X considero il box in Y e Z
|
||||
elseif abs(vtOrtho:getZ()) < 0.001 and abs(vtOrtho:getX()) > 0.999 then
|
||||
-- se corrisponde a Y
|
||||
if ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
-- altrimenti se corrisponde a Z
|
||||
elseif ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
end
|
||||
-- se asse Z orizzontale verifico se si avvicina piú a Y
|
||||
elseif abs(vtOrtho:getZ()) < 0.001 then
|
||||
if abs(vtOrtho:getY()) > 0.75 then
|
||||
-- se corrisponde a Z
|
||||
if ( abs( pPini:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMax():getZ()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL and abs( pPend:getZ() - b3Solid:getMin():getZ()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
end
|
||||
end
|
||||
-- se asse Y a 0 (fresa ne davanti ne dietro) verifico se si avvicina piú a Z+
|
||||
elseif abs(vtOrtho:getY()) < 0.001 then
|
||||
if abs(vtOrtho:getZ()) > 0.75 then
|
||||
-- se corrisponde a Y
|
||||
if ( abs( pPini:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMax():getY()) < 10 * GEO.EPS_SMALL) or
|
||||
( abs( pPini:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL and abs( pPend:getY() - b3Solid:getMin():getY()) < 10 * GEO.EPS_SMALL) then
|
||||
-- setto l'entità open
|
||||
local sActInfo = EgtGetInfo( nPathInt, 'OPEN', 's') or ''
|
||||
if #sActInfo > 0 then
|
||||
EgtSetInfo( nPathInt, 'OPEN', sActInfo .. ',' .. (i-1))
|
||||
else
|
||||
EgtSetInfo( nPathInt, 'OPEN', (i-1))
|
||||
end
|
||||
-- prendo i punti per eventuale modifica del punto di inizio percorso
|
||||
pLastPIni = pPini
|
||||
pLastPEnd = pPend
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se devo cambiare il punto di partenza
|
||||
if nStartPoint then
|
||||
if pLastPIni and pLastPEnd then
|
||||
-- calcolo il punto medio con gli ultimi punti utilizzati
|
||||
local ptPs = ( pLastPIni + pLastPEnd) / 2
|
||||
EgtChangeClosedCurveStartPoint( nPathInt, ptPs, GDB_RT.GLOB)
|
||||
-- se devo eliminare la parte open
|
||||
if nStartPoint == 2 then
|
||||
EgtRemoveCurveCompoCurve( nPathInt, true)
|
||||
EgtRemoveCurveCompoCurve( nPathInt, false)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeRoundCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
nFacInd, nAddGrpId, dDiam, bMillDown, bDoubleSide)
|
||||
@@ -1727,7 +1504,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
return false, sErr
|
||||
end
|
||||
-- distanza di sicurezza per evitare collisioni
|
||||
dCollSic = CalcCollisionSafety( vtN1)
|
||||
dCollSic = BL.CalcCollisionSafety( vtN1)
|
||||
-- elevazione massima della faccia
|
||||
dMaxElev = BL.GetFaceElevation( Proc.Id, nFacInd, nPartId)
|
||||
-- ciclo tutta la tabella
|
||||
@@ -1772,7 +1549,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
nFirstId = EgtCopyGlob( nPathInt, nAddGrpId)
|
||||
nNumId = 1
|
||||
-- distanza di sicurezza per evitare collisioni
|
||||
dCollSic = CalcCollisionSafety( vtOrtho)
|
||||
dCollSic = BL.CalcCollisionSafety( vtOrtho)
|
||||
-- calcolo elevazione dalla faccia trasversale aggiunta
|
||||
local dSurfIntElev = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0)
|
||||
if bDoubleSide then
|
||||
@@ -1797,7 +1574,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
-- normale alla faccia aggiunta
|
||||
vtN1 = Vector3d( vtOrtho)
|
||||
-- imposto i lati aperti
|
||||
SetOpenSide( nFirstId, vtOrtho, b3Solid, nAddGrpId, 2)
|
||||
BL.SetOpenSide( nFirstId, vtOrtho, b3Solid, nAddGrpId, 2)
|
||||
end
|
||||
|
||||
-- se non trovato il percorso, esco
|
||||
@@ -2549,7 +2326,7 @@ local function MakeChamfer( Proc, bIs3Faces, nAddGrpId, vtOrtho, b3Solid, nSurfI
|
||||
if bIs3Faces then
|
||||
-- nAuxId1, _ = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId)
|
||||
-- EgtModifyCurveExtrusion( nAuxId1, vtOrtho, GDB_RT.GLOB)
|
||||
-- SetOpenSide( nAuxId1, vtOrtho, b3Solid, nAddGrpId, 1)
|
||||
-- BL.SetOpenSide( nAuxId1, vtOrtho, b3Solid, nAddGrpId, 1)
|
||||
-- nNumIdAux = 2
|
||||
|
||||
-- estraggo i percorsi
|
||||
@@ -2665,7 +2442,7 @@ local function MakeByMillAsSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
||||
end
|
||||
if bOrthoFaces then
|
||||
-- ottengo le dimensioni del tunnel
|
||||
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId)
|
||||
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
|
||||
end
|
||||
-- Recupero le facce adiacenti alla principale
|
||||
local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1]
|
||||
@@ -2826,7 +2603,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
||||
|
||||
if bOrthoFaces then
|
||||
-- ottengo le dimensioni del tunnel
|
||||
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId)
|
||||
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
|
||||
-- verifico la direzione
|
||||
-- se devo inserire il chamfer
|
||||
if nChamfer > 0 then
|
||||
@@ -3216,7 +2993,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe
|
||||
local bMadeASbyBld, sWarn, nIdMach = Fbs.MakeOne( Proc.Id, nFacet, sCutting, dSawDiam, vtN, nil, ( -0.5 + dExtraOffs), BD.CUT_SIC, 0, 0, 0, nil, b3Raw)
|
||||
if bMadeASbyBld then
|
||||
sWarn = nil
|
||||
if abs(dExtraOffs) > 0 then
|
||||
if not bReduceDepth and abs(dExtraOffs) > 0 then
|
||||
sWarn = 'Warning : antisplint elevation is bigger than max tool depth'
|
||||
end
|
||||
end
|
||||
@@ -3318,8 +3095,10 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo
|
||||
end
|
||||
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
|
||||
local sWarn
|
||||
local dDepth = dElev
|
||||
if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxDepth - dElev)
|
||||
dDepth = dMaxDepth - dElev
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
dElev = dMaxDepth
|
||||
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
@@ -3340,7 +3119,7 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
return true, sWarn, sTuuidPk, dDiamTool
|
||||
return true, sWarn, sTuuidPk, dDiamTool, dDepth
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -3544,7 +3323,7 @@ local function GetUShapeWidth( Proc, nFacInd)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders)
|
||||
local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders, bIsU, bIsL)
|
||||
|
||||
local nFirstMachId
|
||||
local bOrthoFaces
|
||||
@@ -3552,6 +3331,8 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
local sMchFind = 'Pocket'
|
||||
local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt
|
||||
local bBadMach = false
|
||||
-- minima altezza della tasca sotto alla quale fa una contornatura invece di una svuotatura
|
||||
local dMinFaceElevForPocket = 20
|
||||
if sMchFindMaster and #sMchFindMaster > 0 then
|
||||
sMchFind = sMchFindMaster
|
||||
end
|
||||
@@ -3574,7 +3355,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
-- se è un tunnel verifico se è possibile usare la svuotatura
|
||||
if bOrthoFaces then
|
||||
-- ottengo le dimensioni del tunnel
|
||||
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId)
|
||||
dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
|
||||
-- se due facce posso utilizzare utensile con diametro doppio della dimensione minima
|
||||
if Proc.Fct == 2 then
|
||||
dDimMin = 2 * dDimMin
|
||||
@@ -3607,7 +3388,31 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
EgtInvertSurf( nSurfInt)
|
||||
end
|
||||
end
|
||||
if bMakePocket then
|
||||
local nFacInd, dFacElev = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local bMakeContour = false
|
||||
local sMilling
|
||||
if dFacElev < dMinFaceElevForPocket and ( bIsU or bIsL) and ( Proc.Fct == 2 or Proc.Fct == 3) and abs( vtN:getZ()) > 0.996 then
|
||||
bMakeContour = true
|
||||
-- recupero la lavorazione di contornatura
|
||||
sMilling = ML.FindMilling( 'Prof', nil, nil, nil, nil, not bMillDown, bMillDown)
|
||||
if not sMilling then
|
||||
local sMyWarn = 'Warning : Prof not found in library'
|
||||
EgtOutLog( sMyWarn)
|
||||
return true, sMyWarn
|
||||
end
|
||||
-- recupero i dati dell'utensile
|
||||
dDiamTool = 50
|
||||
dMaxDepth = 0
|
||||
if EgtMdbSetCurrMachining( sMilling) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dToolMaxDepth
|
||||
end
|
||||
end
|
||||
end
|
||||
if bMakePocket or bMakeContour then
|
||||
-- gestione svuotatura da un solo lato o anche dal lato opposto (se non verticale)
|
||||
-- estraggo il contorno dalla superfice per evitare i problemi con la svuotatura
|
||||
-- e assegno l'estrusione
|
||||
@@ -3615,7 +3420,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
EgtModifyCurveExtrusion( nPathInt, vtOrtho, GDB_RT.GLOB)
|
||||
-- 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)
|
||||
BL.SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId)
|
||||
end
|
||||
-- variabili per parametri lavorazione
|
||||
local dMachDepth
|
||||
@@ -3624,7 +3429,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
local bOneShot
|
||||
local bComplete = true
|
||||
-- imposto altezza aggiuntiva di elevazione
|
||||
local dCollSic = CalcCollisionSafety( vtOrtho)
|
||||
local dCollSic = BL.CalcCollisionSafety( vtOrtho)
|
||||
-- se possibile svuotare completamente da una sola parte
|
||||
if dMaxDepth > ( dDepth + BD.CUT_EXTRA + dCollSic) then
|
||||
dMachDepth = ( dDepth / 2) + BD.CUT_EXTRA
|
||||
@@ -3633,7 +3438,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
else
|
||||
-- se direzione verso la verticale setto max affondamento possibile ed
|
||||
-- emetto messaggio di warning perché non lavorabile interamente
|
||||
if abs( vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
|
||||
if abs( vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD and not bMakeContour then
|
||||
dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic
|
||||
dElev = dMaxDepth
|
||||
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||
@@ -3668,29 +3473,49 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
local sErr = 'Impossible apply perpendicular pocketing: ' .. sPocketing
|
||||
return -2, sErr
|
||||
end
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, sPocketing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
|
||||
EgtOutLog( sErr)
|
||||
return -1, sErr
|
||||
local sName
|
||||
local nMchFId
|
||||
if bMakeContour then
|
||||
-- inserisco la lavorazione di contornatura
|
||||
sName = 'Prof_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
nMchFId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return -1, sErr
|
||||
end
|
||||
else
|
||||
-- altrimenti inserisco la lavorazione di svuotatura
|
||||
sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
nMchFId = EgtAddMachining( sName, sPocketing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
|
||||
EgtOutLog( sErr)
|
||||
return -1, sErr
|
||||
end
|
||||
end
|
||||
-- prendo l'id della prima lavorazione inserita
|
||||
if not nFirstMachId then
|
||||
nFirstMachId = nMchFId
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nPathInt, -1}})
|
||||
if bMakeContour then
|
||||
-- aggiungo geometria per contornatura
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}})
|
||||
else
|
||||
-- altrimenti aggiungo geometria per svuotatura
|
||||
EgtSetMachiningGeometry( {{ nPathInt, -1}})
|
||||
end
|
||||
-- verifico se devo invertire direzione utensile (in caso di direzione verso la verticale)
|
||||
local bInvertMach
|
||||
if vtOrtho:getZ() < BD.NZ_MINA and abs(vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
bInvertMach = true
|
||||
-- altrimenti se da fare in una sola volta e direzionato verso Y+ lo inverto per lavorarlo davanti
|
||||
elseif not bDoubleSide and vtOrtho:getY() > GEO.EPS_SMALL and not ( -(vtOrtho:getZ()) < BD.NZ_MINA) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
bInvertMach = true
|
||||
if not bMakeContour then
|
||||
if vtOrtho:getZ() < BD.NZ_MINA and abs(vtOrtho:getZ()) >= 0.707 and not BD.DOWN_HEAD then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
bInvertMach = true
|
||||
-- altrimenti se da fare in una sola volta e direzionato verso Y+ lo inverto per lavorarlo davanti
|
||||
elseif not bDoubleSide and vtOrtho:getY() > GEO.EPS_SMALL and not ( -(vtOrtho:getZ()) < BD.NZ_MINA) then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
bInvertMach = true
|
||||
end
|
||||
end
|
||||
-- imposto posizione braccio porta testa
|
||||
local nSCC = MCH_SCC.NONE
|
||||
@@ -3711,11 +3536,50 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||
end
|
||||
-- inverto il percorso di lavorazione per lavorare sinistro
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
if not bMakeContour then
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
end
|
||||
-- imposto affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
|
||||
if not bMakeContour then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
|
||||
end
|
||||
-- se contornatura doppia anticipo la fine della lavorazione a metà trave
|
||||
if bMakeContour and bDoubleSide then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSL, dDepth / 2)
|
||||
end
|
||||
-- se contornatura cerco la direzione di lavoro migliore e setto attacco e allungamenti
|
||||
if bMakeContour then
|
||||
local nFaceUse = BL.GetNearestParalOpposite( vtOrtho)
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- quantità di cui allargare la contornatura per andare in tangenza con lo spigolo, nel caso di altezza tasca minore di D/2 fresa
|
||||
local dAddWorkWidth = EgtIf( dFacElev < dDiamTool / 2, -sqrt( dFacElev * dDiamTool - dFacElev * dFacElev), -dDiamTool / 2)
|
||||
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LOELEV, 0)
|
||||
if bIsU then
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAddWorkWidth)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAddWorkWidth)
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
|
||||
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR)
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, 30)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, 30)
|
||||
elseif bIsL then
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, 30)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAddWorkWidth)
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.TANGENT)
|
||||
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR)
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, 30)
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, 30)
|
||||
end
|
||||
end
|
||||
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
|
||||
local sNotes = ''
|
||||
if not bMakeContour then
|
||||
sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
|
||||
end
|
||||
sNotes = sNotes .. 'VMRS=0;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- eseguo
|
||||
@@ -3758,20 +3622,36 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
end
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
local sName = 'PockOppo_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchFId = EgtAddMachining( sName, EgtIf( bMakePocketDn, sPocketingDn, sPocketing))
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. EgtIf( bMakePocketDn, sPocketingDn, sPocketing)
|
||||
EgtOutLog( sErr)
|
||||
return -1, sErr
|
||||
if bMakeContour then
|
||||
-- inserisco la lavorazione di contornatura
|
||||
sName = 'ProfOppo_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
nMchFId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
|
||||
EgtOutLog( sErr)
|
||||
return -1, sErr
|
||||
end
|
||||
else
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
sName = 'PockOppo_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
nMchFId = EgtAddMachining( sName, EgtIf( bMakePocketDn, sPocketingDn, sPocketing))
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. EgtIf( bMakePocketDn, sPocketingDn, sPocketing)
|
||||
EgtOutLog( sErr)
|
||||
return -1, sErr
|
||||
end
|
||||
end
|
||||
-- prendo l'id della prima lavorazione inserita
|
||||
if not nFirstMachId then
|
||||
nFirstMachId = nMchFId
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ nPathInt, -1}})
|
||||
if bMakeContour then
|
||||
-- aggiungo geometria per contornatura
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}})
|
||||
else
|
||||
-- altrimenti aggiungo geometria per svuotatura
|
||||
EgtSetMachiningGeometry( {{ nPathInt, -1}})
|
||||
end
|
||||
-- imposto direzione utensile opposta
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
||||
-- imposto posizione braccio porta testa
|
||||
@@ -3793,11 +3673,49 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN)
|
||||
end
|
||||
-- inverto il percorso di lavorazione per lavorare sinistro
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
-- imposo affondamento
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
-- imposto affondamento
|
||||
if not bMakeContour then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
|
||||
end
|
||||
-- se contornatura doppia anticipo la fine della lavorazione a metà trave
|
||||
if bMakeContour and bDoubleSide then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSL, dDepth / 2)
|
||||
end
|
||||
-- se contornatura cerco la direzione di lavoro migliore
|
||||
if bMakeContour then
|
||||
local nFaceUse = BL.GetNearestParalOpposite( vtOrtho)
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- quantità di cui allargare la contornatura per andare in tangenza con lo spigolo, nel caso di altezza tasca minore di D/2 fresa
|
||||
local dAddWorkWidth = EgtIf( dFacElev < dDiamTool / 2, -sqrt( dFacElev * dDiamTool - dFacElev * dFacElev), -dDiamTool / 2)
|
||||
EgtSetMachiningParam( MCH_MP.LIELEV, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LOELEV, 0)
|
||||
if bIsU then
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAddWorkWidth)
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAddWorkWidth)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAddWorkWidth)
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
|
||||
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.LINEAR)
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, 30)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, 30)
|
||||
elseif bIsL then
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAddWorkWidth)
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, 30)
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MCH_MILL_LI.LINEAR)
|
||||
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LI.TANGENT)
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, 0)
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, 30)
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, 30)
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
|
||||
end
|
||||
end
|
||||
-- imposto elevazione e dichiaro non si generano sfridi per VMill
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
|
||||
sNotes = ''
|
||||
if not bMakeContour then
|
||||
sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';'
|
||||
end
|
||||
sNotes = sNotes .. 'VMRS=0;'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- eseguo
|
||||
@@ -3823,7 +3741,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
||||
end
|
||||
if bPock3rd then
|
||||
-- recupero la distanza di sicurezza aggiuntiva
|
||||
local dFacCollSic = CalcCollisionSafety( vtN)
|
||||
local dFacCollSic = BL.CalcCollisionSafety( vtN)
|
||||
-- scelgo se lavorare da sotto
|
||||
local bFacPocketDn = ( bMakePocketDn and vtN:getZ() < -0.174)
|
||||
-- inserisco la lavorazione di svuotatura
|
||||
@@ -4217,7 +4135,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
end
|
||||
-- prendo il primo versore
|
||||
_, vtN1 = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
dCollSic = CalcCollisionSafety( vtN1) or 0
|
||||
dCollSic = BL.CalcCollisionSafety( vtN1) or 0
|
||||
-- se direzione tende verso una delle alle 3 direzioni azzero l'altezza extra
|
||||
if abs( vtN1:getX()) > 0.7 or abs( vtN1:getY()) > 0.7 or abs( vtN1:getZ()) > 0.7 then dCollSic = 0 end
|
||||
|
||||
@@ -4274,7 +4192,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
-- alrimenti ho la faccia aggiunta
|
||||
else
|
||||
|
||||
dCollSic = CalcCollisionSafety( vtOrtho)
|
||||
dCollSic = BL.CalcCollisionSafety( vtOrtho)
|
||||
nFirstId = EgtCopyGlob( nPathInt, nAddGrpId)
|
||||
nNumId = 1
|
||||
-- calcolo elevazione dalla faccia trasversale aggiunta
|
||||
@@ -4298,7 +4216,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
end
|
||||
end
|
||||
vtN1 = Vector3d(vtOrtho)
|
||||
local bOkPath = SetOpenSide( nFirstId, vtOrtho, b3Solid, nAddGrpId, 2)
|
||||
local bOkPath = BL.SetOpenSide( nFirstId, vtOrtho, b3Solid, nAddGrpId, 2)
|
||||
-- se non ho un percorso chiuso estraggo i percorsi
|
||||
if bOkPath then
|
||||
-- creo percorsi antisplint dagli estremi dei percorsi di contorno trovati
|
||||
@@ -4349,6 +4267,59 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
|
||||
return true, sMyWarn
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeTunnelByChainSaw( Proc, sSawing, nLundIdFace, vtOrtho, dWorkDepth, dMaxMat, nStep, dStep, sFaceUse, bOpposite)
|
||||
for i = 1, nStep do
|
||||
-- inserisco la lavorazione di sawing
|
||||
local sName = ''
|
||||
if bOpposite then
|
||||
sName = 'Csaw_Opp_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i)
|
||||
else
|
||||
sName = 'Csaw_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i)
|
||||
end
|
||||
local nMchFId = EgtAddMachining( sName, sSawing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, nLundIdFace}})
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT)
|
||||
-- imposto angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||
-- imposto offset radiale
|
||||
local dOffs = ( i - 1) * dStep
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, sFaceUse)
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dWorkDepth)
|
||||
-- modifico la distanza di attacco per considerare anche tunnel inclinati
|
||||
EgtSetMachiningParam( MCH_MP.STARTPOS, 50)
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
if EgtGetOutstrokeInfo() then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
if EgtIsMachiningEmpty() then
|
||||
_, sWarn = EgtGetMachMgrWarning( 0)
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sWarn
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap)
|
||||
if not BD.MAXDIAM_POCK_CORNER then
|
||||
@@ -4470,63 +4441,40 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
if nStep > 1 then
|
||||
dStep = ( dDimMin - dSawThick) / ( nStep - 1)
|
||||
end
|
||||
for i = 1, nStep do
|
||||
-- inserisco la lavorazione di sawing
|
||||
local sName = 'Csaw_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i)
|
||||
local nMchFId = EgtAddMachining( sName, sSawing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, nLundIdFace}})
|
||||
-- imposto uso del lato faccia
|
||||
-- al momento, dato che la fessura è passante da parte a parte, gestisco solo la lavorazione
|
||||
-- dall'alto e di fronte (da dietro è disabilitata perchè ho extracorsa con la FAST).
|
||||
-- Questa feature non è applicata su facce di testa e quindi non controllo l'entrata in X
|
||||
if abs(vtOrtho:getZ()) >= 0.707 then
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_DOWN)
|
||||
else
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_BACK)
|
||||
end
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT)
|
||||
-- imposto angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 1))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1))
|
||||
-- imposto offset radiale
|
||||
local dOffs = ( i - 1) * dStep
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||
-- se possibile aumento l'affondamento pari al raggio corner + 1
|
||||
if dMaxMat > (dDepth + dSawCornerRad + 1) then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, (dDepth + dSawCornerRad + 1))
|
||||
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
|
||||
elseif dMaxMat < dDepth then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
|
||||
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
if EgtGetOutstrokeInfo() then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetChainSawBlockedAxis( 2))
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 2))
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
end
|
||||
end
|
||||
if EgtIsMachiningEmpty() then
|
||||
_, sWarn = EgtGetMachMgrWarning( 0)
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sWarn
|
||||
local bSplit = false
|
||||
local sFaceUse, sFaceUseOtherSide
|
||||
-- imposto il lato di lavorazione, da sopra oppure di fronte
|
||||
-- se è di fronte, non è una Fast e il tagliente non arriva splitto la lavorazione
|
||||
-- Questa feature non è applicata su facce di testa e quindi non controllo l'entrata in X
|
||||
if abs(vtOrtho:getZ()) >= 0.707 then
|
||||
sFaceUse = MCH_MILL_FU.PARAL_DOWN
|
||||
else
|
||||
sFaceUse = MCH_MILL_FU.PARAL_BACK
|
||||
-- per escludere la Fast controllo C_SIMM
|
||||
if BD.C_SIMM and dMaxMat < dDepth then
|
||||
bSplit = true
|
||||
sFaceUseOtherSide = MCH_MILL_FU.PARAL_FRONT
|
||||
dDepth = dDepth / 2 + BD.CUT_EXTRA
|
||||
end
|
||||
end
|
||||
local dWorkDepth = dDepth
|
||||
-- cerco di estendere il taglio considerando la parte arrotondata della lama + 1
|
||||
if dMaxMat > dDepth + dSawCornerRad + 1 then
|
||||
dWorkDepth = dDepth + dSawCornerRad + 1
|
||||
-- se massimo affondamento utensile inferiore alla profondità da lavorare, setto la profondità di lavoro e emetto warning
|
||||
elseif dMaxMat < dDepth then
|
||||
dWorkDepth = dMaxMat
|
||||
sWarn = 'Warning : elevation bigger than max tool depth'
|
||||
EgtOutLog( sWarn)
|
||||
end
|
||||
-- lavoro da un lato
|
||||
local bOk, sErr = MakeTunnelByChainSaw( Proc, sSawing, nLundIdFace, vtOrtho, dWorkDepth, dMaxMat, nStep, dStep, sFaceUse, false)
|
||||
if not bOk then return false, sErr end
|
||||
-- se è da lavorare anche dall'altro lato
|
||||
if bSplit then
|
||||
bOk, sErr = MakeTunnelByChainSaw( Proc, sSawing, nLundIdFace, vtOrtho, dWorkDepth, dMaxMat, nStep, dStep, sFaceUseOtherSide, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- altrimenti non è una fessura
|
||||
@@ -4837,7 +4785,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- imposto altezza aggiuntiva di elevazione
|
||||
local dCollSic = CalcCollisionSafety( vtN)
|
||||
local dCollSic = BL.CalcCollisionSafety( vtN)
|
||||
-- abilitazione lavorazione da sotto
|
||||
local bMillUp = ( BD.DOWN_HEAD and vtN:getZ() > -0.259)
|
||||
local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.342)
|
||||
@@ -5104,7 +5052,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
-- se devo inserire il chamfer
|
||||
if ( ( Proc.Fct == 3 and bIsU) or (Proc.Fct == 2 and bIsL)) and nChamfer > 0 then
|
||||
-- ottengo le dimensioni dello pseudotunnel
|
||||
local _, _, _, vtOrtho, _, nSurfInt = GetTunnelDimension( Proc, nPartId)
|
||||
local _, _, _, vtOrtho, _, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
|
||||
local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham)
|
||||
if nOk < 0 then return false, sErr end
|
||||
end
|
||||
@@ -5118,13 +5066,16 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
-- 2021.07.16 Per poter eseguire antischeggia di lama su feature che non sono passanti da faccia a faccia
|
||||
-- ma che sono su un angolo (coinvolgono 2 facce contigue) è stato modificato il confronto in:
|
||||
-- esegue antischeggia di lama se forma U o L con feature passante in Y o Z, oppure se feature a furma U e con 3 facce oppore a forma a L e con 2 facce
|
||||
-- non fa mai antischeggia di lama se la faccia è rivolta verso il basso, a meno che ci sia una testa sotto
|
||||
local bMadeASbyBld = false
|
||||
local bPassThrou = ( Proc.Box:getDimY() > b3Raw:getDimY() - 1 or Proc.Box:getDimZ() > b3Raw:getDimZ() - 1)
|
||||
local bPassEdge = ((( bIsU and Proc.Fct == 3) or ( bIsL and Proc.Fct == 2)) and bSinglePart and Proc.Box:getDimX() < 0.9 * b3Raw:getDimX())
|
||||
if nChamfer < 2 and nQAntisplintResult == 1 and (( bIsU or bIsL) and ( bPassThrou or bPassEdge)) then
|
||||
local nFacIndOri = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
|
||||
local vtNOri = EgtSurfTmFacetNormVersor( Proc.Id, nFacIndOri, GDB_ID.ROOT)
|
||||
if nChamfer < 2 and nQAntisplintResult == 1 and (( bIsU or bIsL) and ( bPassThrou or bPassEdge)) and ( vtNOri:getZ() > -0.087 or BD.DOWN_HEAD) then
|
||||
local bOk
|
||||
local bSawDown = ( bMillDown and not bMillUp)
|
||||
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacInd, sWarn, bSawDown, true)
|
||||
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtNOri, nFacIndOri, sWarn, bSawDown, true)
|
||||
if not bOk then return false, sWarn end
|
||||
end
|
||||
-- in base al flag interno e al numero di facce e se ha forma ad U
|
||||
@@ -5147,13 +5098,13 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
-- 3 facce non a L ma con una faccia favorevole a Y, oppure
|
||||
-- 4 facce
|
||||
-- lancio la MakePocket ( lavorazione solo da un lato, fondo della tasca la faccia più favorevole a Y)
|
||||
if bForceSideMill and (( Proc.Fct == 3 and bIsL) or ( Proc.Fct == 3 and abs( vtNFacApproxY:getY()) >= 0.707 ) or Proc.Fct == 4) then
|
||||
if bForceSideMill and (( Proc.Fct == 3 and bIsL) or ( ( Proc.Fct == 3 or Proc.Fct == 2) and abs( vtNFacApproxY:getY()) >= 0.707 ) or Proc.Fct == 4) then
|
||||
nFacInd, vtN, ptC = nFacApproxY, vtNFacApproxY, ptCFacApproxY
|
||||
local tvtNx = {}
|
||||
tvtNx[2] = vtN
|
||||
local ptPs = ptC
|
||||
dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd)
|
||||
dCollSic = CalcCollisionSafety( tvtNx[2])
|
||||
dCollSic = BL.CalcCollisionSafety( tvtNx[2])
|
||||
local dMachDepth = dFacElev + dCollSic
|
||||
local frFacRec, dFacDim1, dFacDim2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
-- limito il diametro utensile massimo a 100 per queste lavorazioni
|
||||
@@ -5194,7 +5145,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
dToolMaxDiam = min ( dFacDim1, dFacDim2, dToolTargetDiam)
|
||||
end
|
||||
local _, sPocketing = VerifyPocket( Proc, dToolMaxDiam, dFacElev, nil, sMyMchFind)
|
||||
bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap)
|
||||
bOk, sWarn2, sTuuidPk, dDiamTool, dDepth = 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
|
||||
@@ -5205,8 +5156,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
-- 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,
|
||||
nFacInd, nAddGrpId, bMillDown, dDiamTool, nil,
|
||||
nil, nil, nil, b3Solid, dDepth,
|
||||
bOneShot, nFirstMachId)
|
||||
if sWarn2 then
|
||||
if not sWarn then sWarn = '' end
|
||||
@@ -5235,7 +5186,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
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)
|
||||
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders, bIsU, bIsL)
|
||||
if nOk == -2 then
|
||||
if not sMchFind then
|
||||
sMchFind = sMchFindBackUp
|
||||
@@ -5255,10 +5206,11 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
sWarn = sErr
|
||||
-- se ho antischeggia con fresa le inserisco
|
||||
-- if nChamfer < 2 and nQAntisplintResult == 2 and ( bIsU or bIsL) then
|
||||
local nFacIndOri, dFacElevOri = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
|
||||
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,
|
||||
nFacIndOri, nAddGrpId, bMillDown, dDiamTool, nil,
|
||||
nil, nil, nil, b3Solid, dFacElevOri,
|
||||
bOneShot, nFirstMachId)
|
||||
if sWarn2 then
|
||||
if not sWarn then sWarn = '' end
|
||||
@@ -5340,7 +5292,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
-- se devo inserire il chamfer
|
||||
if ( ( Proc.Fct == 3 and bIsU) or (Proc.Fct == 2 and bIsL)) and nChamfer > 0 then
|
||||
-- ottengo le dimensioni dello pseudotunnel
|
||||
local _, _, _, vtOrtho, _, nSurfInt = GetTunnelDimension( Proc, nPartId)
|
||||
local _, _, _, vtOrtho, _, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
|
||||
local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham)
|
||||
if nOk < 0 then return false, sErr end
|
||||
end
|
||||
@@ -5351,13 +5303,16 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
||||
-- 2021.07.16 Per poter eseguire antischeggia di lama su feature che non sono passanti da faccia a faccia
|
||||
-- ma che sono su un angolo (coinvolgono 2 facce contigue) è stato modificato il confronto in:
|
||||
-- esegue antischeggia di lama se forma U o L con feature passante in Y o Z, oppure se feature a furma U e con 3 facce oppore a forma a L e con 2 facce
|
||||
-- non fa mai antischeggia di lama se la faccia è rivolta verso il basso, a meno che ci sia una testa sotto
|
||||
local bMadeASbyBld = false
|
||||
local bPassThrou = ( Proc.Box:getDimY() > b3Raw:getDimY() - 1 or Proc.Box:getDimZ() > b3Raw:getDimZ() - 1)
|
||||
local bPassEdge = ((( bIsU and Proc.Fct == 3) or ( bIsL and Proc.Fct == 2)) and bSinglePart and Proc.Box:getDimX() < 0.9 * b3Raw:getDimX())
|
||||
if nChamfer < 2 and nQAntisplintResult == 1 and (( bIsU or bIsL) and ( bPassThrou or bPassEdge)) then
|
||||
local nFacIndOri = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
|
||||
local vtNOri = EgtSurfTmFacetNormVersor( Proc.Id, nFacIndOri, GDB_ID.ROOT)
|
||||
if nChamfer < 2 and nQAntisplintResult == 1 and (( bIsU or bIsL) and ( bPassThrou or bPassEdge)) and ( vtNOri:getZ() > -0.087 or BD.DOWN_HEAD) then
|
||||
local bOk
|
||||
local bSawDown = ( bMillDown and not bMillUp)
|
||||
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacInd, sWarn, bSawDown)
|
||||
bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtNOri, nFacIndOri, sWarn, bSawDown)
|
||||
if not bOk then return false, sWarn end
|
||||
end
|
||||
if nChamfer < 2 and nQAntisplintResult == 2 then
|
||||
@@ -5596,7 +5551,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- in base al tipo di feature attribuisco il significato dei parametri Q
|
||||
AssignQIdent( Proc)
|
||||
-- se non forzate frese, uso la lama
|
||||
local bUseBlade = EgtGetInfo( Proc.Id, Q_USE_ROUGH_TOOL, 'i') ~= 1 and EgtGetInfo( Proc.Id, Q_USE_MILL, 'i') ~= 1
|
||||
local bUseBlade = EgtIf( Proc.Prc == 90, false, EgtGetInfo( Proc.Id, Q_USE_ROUGH_TOOL, 'i') ~= 1 and EgtGetInfo( Proc.Id, Q_USE_MILL, 'i') ~= 1)
|
||||
local nForceUseBladeOnNotContinueFace
|
||||
-- se ho attivo la lama e ho la feature 30, verifico i parametri Q propri della feature
|
||||
if bUseBlade then
|
||||
@@ -5723,6 +5678,9 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
-- se piccola, con fresa
|
||||
if not bUseBlade and ( Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN)) then
|
||||
return MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
|
||||
-- se è una spianatura a una faccia richiamo la LongCut
|
||||
elseif Proc.Prc == 90 then
|
||||
return LongCut.Make( Proc, nPhase, nRawId, nPartId)
|
||||
-- altrimenti, con lama
|
||||
else
|
||||
return Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
@@ -5767,7 +5725,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local nChamfer, dDepthCham, sErrCham = EvaluateQParam( Proc)
|
||||
-- se smusso da fare
|
||||
if nChamfer > 0 then
|
||||
local _, _, _, vtOrtho, _, nSurfInt = GetTunnelDimension( Proc, nPartId)
|
||||
local _, _, _, vtOrtho, _, nSurfInt = BL.GetTunnelDimension( Proc, nPartId)
|
||||
local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham)
|
||||
if nOk < 0 then return false, sErr end
|
||||
end
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
-- 2021/11/08 Se con lama e flag BD.USE_LONGCUT si lavora in direzione contraria allo standard.
|
||||
-- 2022/03/07 Razionalizzata gestione casi con fresa di fianco. Aggiunta gestione Long2Cut anche con testa sotto.
|
||||
-- 2022/07/14 Aggiunta limitazione lavorazione a sinistra anche se il grezzo successivo non ha lavorazioni (finale barra) ma è abbastanza lungo da poter essere riutilizzato (BD.MinRaw).
|
||||
-- 2022/09/23 Modificato l'angolo per l'abilitazione della lama da sotto: ora interviene anche per facce verticali.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessLongCut = {}
|
||||
@@ -436,8 +437,8 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus
|
||||
if ( nSide == -1 or abs(nSide) == 2) and vtN:getZ() <= -0.5 then
|
||||
bCanUseUnderBlade = true
|
||||
end
|
||||
-- se faccia da sotto o di lato ma con versore Z negativo abilito la lavorazione con lame mixate
|
||||
if ( nSide == -1 or abs(nSide) == 2) and vtN:getZ() <= -0.0175 then
|
||||
-- se faccia da sotto o di lato ma con versore Z sotto l'orizzontale abilito la lavorazione con lame mixate
|
||||
if ( nSide == -1 or abs(nSide) == 2) and vtN:getZ() <= 0.0175 then
|
||||
bCanUseUnderBlade = true
|
||||
end
|
||||
-- se faccia da sopra o di lato ma con versore Z negativo verifico che abbia un angolo compatibile (28deg) per non avere extracorsa
|
||||
|
||||
@@ -323,8 +323,8 @@ function ProcessMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
|
||||
-- Se mortasa chiusa
|
||||
if not bOpenBtm then
|
||||
-- verifico che la mortasa non sia orientata verso il basso (limite -5 deg) o che ci sia una testa da sotto o un rinvio angolare
|
||||
if vtN:getZ() < -0.1 and not BD.DOWN_HEAD and not BD.ANG_TRASM then
|
||||
-- verifico che la mortasa non sia orientata verso il basso (limite -5 deg) o che ci sia una testa da sotto o un rinvio angolare o macchina Turn
|
||||
if vtN:getZ() < -0.1 and not BD.DOWN_HEAD and not BD.ANG_TRASM and not BD.TURN then
|
||||
local sErr = 'Error : Mortise from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
|
||||
@@ -440,7 +440,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local sMillingDown
|
||||
if bDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
|
||||
if not sMillingDown then
|
||||
@@ -448,7 +448,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
else
|
||||
elseif not BD.TURN then
|
||||
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
@@ -489,7 +489,9 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- 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))
|
||||
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
@@ -588,7 +590,9 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
end
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
@@ -633,7 +637,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
|
||||
-- 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 or BD.DOWN_HEAD))) then
|
||||
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
|
||||
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchVId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchVId then
|
||||
@@ -659,6 +663,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
|
||||
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
||||
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -669,7 +674,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
|
||||
-- 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 or BD.DOWN_HEAD))) then
|
||||
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
|
||||
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchV2Id = EgtAddMachining( sName, sMilling)
|
||||
if not nMchV2Id then
|
||||
@@ -692,6 +697,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
|
||||
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
|
||||
@@ -440,7 +440,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
local sMillingDown
|
||||
if bDouble then
|
||||
if nSide == 0 then
|
||||
if BD.DOWN_HEAD then
|
||||
if BD.DOWN_HEAD then
|
||||
-- recupero la lavorazione
|
||||
sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true)
|
||||
if not sMillingDown then
|
||||
@@ -448,7 +448,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
end
|
||||
else
|
||||
elseif not BD.TURN then
|
||||
sWarn = 'Warning in profiling : depth (' .. EgtNumToString( dProfDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dToolMaxDepth, 1) .. ')'
|
||||
EgtOutLog( sWarn)
|
||||
bDouble = false
|
||||
@@ -489,7 +489,9 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- 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))
|
||||
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
@@ -588,7 +590,9 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
|
||||
end
|
||||
-- posizione braccio porta testa
|
||||
EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM))
|
||||
local nSCC = EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
||||
if BD.TURN then nSCC = MCH_SCC.ADIR_ZP end
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- variabili per gestione direzione percorso e per gestione lavorazione di finitura opzionale
|
||||
local bFinish
|
||||
local dOriOffset = 0
|
||||
@@ -633,7 +637,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
|
||||
-- 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 or BD.DOWN_HEAD))) then
|
||||
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
|
||||
sName = 'ProfV_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchVId = EgtAddMachining( sName, sMilling)
|
||||
if not nMchVId then
|
||||
@@ -659,6 +663,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH')
|
||||
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
||||
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -669,7 +674,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
-- se parametro Q disabilitato, e consentito anche in alcuni casi lavorarlo con la feature da sotto
|
||||
-- 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 or BD.DOWN_HEAD))) then
|
||||
( nSide ~= -1 or ( nSide == -1 and ( EgtGetInfo( Proc.Id, sMachFacesUnderneath, 'i') == 1 or BD.DOWN_HEAD or BD.TURN))) then
|
||||
sName = 'ProfV2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
||||
local nMchV2Id = EgtAddMachining( sName, sMilling)
|
||||
if not nMchV2Id then
|
||||
@@ -692,6 +697,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
EgtSetMachiningParam( MCH_MP.STEP, 0)
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, 0)
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dWidth, 1))
|
||||
if BD.TURN then EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_ZP) end
|
||||
-- eseguo
|
||||
if not ML.ApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
@@ -701,12 +707,13 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH)
|
||||
end
|
||||
end
|
||||
-- aggiorno ingombro testa o coda per presa
|
||||
if nSide ~= 1 then
|
||||
if nSide ~= 1 then -- se feature di fianco o da sotto
|
||||
if bHead then
|
||||
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMin():getX())
|
||||
else
|
||||
BL.UpdateTCING( nRawId, Proc.Box:getMax():getX() - b3Solid:getMin():getX())
|
||||
end
|
||||
-- altrimenti feature da sopra
|
||||
else
|
||||
if bHead then
|
||||
BL.UpdateHCING( nRawId, b3Raw:getMax():getX() - dCurrOvmH - Proc.Box:getMax():getX())
|
||||
|
||||
@@ -500,20 +500,20 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa
|
||||
if abs( vtRef:getZ()) > 0.1 then
|
||||
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
||||
if b3Fac1 then dHCI = b3Raw:getMax():getX() - dOvmHead - b3Fac1:getMin():getX() end
|
||||
dHCI = 0.75 * dHCI
|
||||
else
|
||||
dHCI = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX()
|
||||
end
|
||||
dHCI = 0.75 * dHCI
|
||||
BL.UpdateHCING( nRawId, dHCI)
|
||||
elseif Proc.Tail then
|
||||
local dTCI = 0
|
||||
if abs( vtRef:getZ()) > 0.1 then
|
||||
local b3Fac1 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, vFaceOrd[1] - 1, GDB_BB.STANDARD)
|
||||
if b3Fac1 then dTCI = b3Fac1:getMax():getX() - b3Solid:getMin():getX() end
|
||||
dTCI = 0.75 * dTCI
|
||||
else
|
||||
dTCI = Proc.Box:getMax():getX() - b3Solid:getMin():getX()
|
||||
end
|
||||
dTCI = 0.75 * dTCI
|
||||
BL.UpdateTCING( nRawId, dTCI)
|
||||
end
|
||||
|
||||
|
||||
+101
-90
@@ -1,7 +1,10 @@
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2022/07/26
|
||||
-- ProcessSplit.lua by Egaltech s.r.l. 2022/08/18
|
||||
-- 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.
|
||||
-- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata.
|
||||
-- 2022/09/08 Migliorato verso di lavorazione in caso di DoubleCut
|
||||
-- 2022/09/26 Gestione dei tagli di lama (Horiz, double, etc.) estesa anche a BigSection
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessSplit = {}
|
||||
@@ -261,13 +264,25 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
end
|
||||
end
|
||||
local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0)
|
||||
-- recupero la eventuale lavorazione con lama da sotto
|
||||
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
|
||||
-- recupero i dati della eventuale seconda lama
|
||||
local dSawDiam2 = 0
|
||||
local dMaxDepth2 = 0
|
||||
if sCutting2 and EgtMdbSetCurrMachining( sCutting2) then
|
||||
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
|
||||
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
|
||||
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
|
||||
end
|
||||
end
|
||||
-- caratteristiche taglio
|
||||
local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM))
|
||||
local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and
|
||||
( b3Raw:getDimZ() > EgtIf( BD.DOWN_HEAD or BD.TURN, 2, 1) * dMaxVertDepth - 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)
|
||||
( b3Raw:getDimZ() > EgtIf( BD.TURN, 2 * dMaxVertDepth, dMaxVertDepth + dMaxDepth2) - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and ( b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA))
|
||||
local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL)
|
||||
local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL)
|
||||
-- dati geometrici del taglio
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
-- flag di lavorazione faccia
|
||||
@@ -291,6 +306,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
end
|
||||
-- se taglio per pezzi alti e larghi
|
||||
local nNewPhase = 0
|
||||
local bFinishByBlade = not bBigSectionCut
|
||||
if bBigSectionCut then
|
||||
local bFinishingNeeded = false
|
||||
if bSplit then
|
||||
@@ -367,12 +383,12 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
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
|
||||
local nQ05 = EgtGetInfo( nOriId or GDB_ID.NULL, 'Q05', 'i') or 0
|
||||
-- se finitura con lama rimando ai casi standard
|
||||
if nQ05 == 1 or nQ05 == 0 or not bSplit then
|
||||
bFinishByBlade = true
|
||||
-- se finitura con truciolatore
|
||||
elseif EgtGetInfo( nOriId, 'Q05', 'i') == 2 then
|
||||
elseif nQ05 == 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'
|
||||
@@ -392,94 +408,89 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal)
|
||||
end
|
||||
end
|
||||
-- se tagli standard
|
||||
elseif not bDoubleHorizCut then
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = 0
|
||||
local dAccStart = 0
|
||||
local dAccEnd = 0
|
||||
if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
|
||||
dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
|
||||
else
|
||||
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
|
||||
local dSawRad = dSawDiam / 2
|
||||
local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN
|
||||
if BD.C_SIMM then
|
||||
dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||
end
|
||||
-- tagli standard con lama
|
||||
if bFinishByBlade then
|
||||
if not bDoubleHorizCut then
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = 0
|
||||
local dAccStart = 0
|
||||
local dAccEnd = 0
|
||||
if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then
|
||||
dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA)
|
||||
else
|
||||
dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||
dCutExtra = - ( b3Raw:getDimY() - dMaxDepth)
|
||||
local dSawRad = dSawDiam / 2
|
||||
local dKL = dSawRad - dMaxDepth + b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN
|
||||
if BD.C_SIMM then
|
||||
dAccEnd = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||
else
|
||||
dAccStart = sqrt( dSawRad * dSawRad - dKL * dKL)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se necessari tagli in doppio, eseguo gli opposti
|
||||
if bDoubleCut then
|
||||
-- se necessari tagli in doppio, eseguo gli opposti
|
||||
if bDoubleCut then
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, true)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
-- eseguo i tagli necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local sNotes
|
||||
if bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
|
||||
else
|
||||
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
|
||||
else
|
||||
-- verifico esistenza della lavorazione con lama da sotto
|
||||
if not sCutting2 then
|
||||
local sErr = 'Error : cutting H2 not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico che le due lame riescano a lavorare la sezione
|
||||
local dDimZ = b3Raw:getDimZ()
|
||||
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
|
||||
if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then
|
||||
local sErr = 'Error : section too big for tail cut'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dAccStart = 0
|
||||
-- limiti da sotto
|
||||
local dVzLimDwnUp
|
||||
if BD.TURN then dVzLimDwnUp = -2 end
|
||||
-- eseguo i tagli da sotto necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
-- eseguo i tagli necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local sNotes
|
||||
if bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
|
||||
else
|
||||
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
|
||||
-- eseguo i tagli da sopra necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local sNotes
|
||||
if bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
|
||||
else
|
||||
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- altrimenti necessari tagli da sopra e sotto con testa opportuna
|
||||
else
|
||||
-- recupero la lavorazione con lama da sotto
|
||||
local sCutting2 = ML.FindCutting( 'TailSide_H2', false, true)
|
||||
if not sCutting2 then
|
||||
local sErr = 'Error : cutting H2 not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- recupero i dati della seconda lama
|
||||
local dSawDiam2 = 400
|
||||
local dMaxDepth2 = 50
|
||||
if EgtMdbSetCurrMachining( sCutting2) then
|
||||
local sTuuid2 = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then
|
||||
dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2
|
||||
dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2
|
||||
end
|
||||
end
|
||||
-- verifico che le due lame riescano a lavorare la sezione
|
||||
local dDimZ = b3Raw:getDimZ()
|
||||
local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ
|
||||
if dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0 then
|
||||
local sErr = 'Error : section too big for tail cut'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- calcolo extra taglio ed accorciamento
|
||||
local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN
|
||||
local dAccStart = 0
|
||||
-- eseguo i tagli da sotto necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;')
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, nil, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
-- eseguo i tagli da sopra necessari
|
||||
for i = nCuts, 1, -1 do
|
||||
local dCutOffset = ( i - 1) * dOffsL
|
||||
local sNotes
|
||||
if bSplit then
|
||||
sNotes = EgtIf( i == 1, 'Split;', 'Presplit;')
|
||||
else
|
||||
sNotes = EgtIf( i == 1, 'Cut;', 'Precut;')
|
||||
end
|
||||
local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw)
|
||||
if not bOk then return false, sErr end
|
||||
end
|
||||
end
|
||||
return true, nil, nNewPhase
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
-- 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.
|
||||
-- 2022/09/20 Migliorato il calcolo delle passate laterali; ora considera la reale distanza tra contorno del tenone e estremi della faccia
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local ProcessTenon = {}
|
||||
@@ -120,11 +121,32 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
|
||||
local vtN = vtExtr
|
||||
local ptC = ptBC + vtN * dTenH
|
||||
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
|
||||
-- determino larghezza massima di svuotatura
|
||||
local b3Aux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frTen)
|
||||
local dPockX = max( b3Ten:getMax():getX() - b3Aux:getMax():getX(), b3Aux:getMin():getX() - b3Ten:getMin():getX())
|
||||
local dPockY = max( b3Ten:getMax():getY() - b3Aux:getMax():getY(), b3Aux:getMin():getY() - b3Ten:getMin():getY())
|
||||
local dPockL = sqrt( dPockX * dPockX + dPockY * dPockY)
|
||||
-- determino larghezza svuotatura per calcolare il numero di passate laterali
|
||||
-- ricavo i contorni della faccia principale
|
||||
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
|
||||
local dPockL = 0
|
||||
-- ricavo la massima distanza tra gli estremi della faccia e la curva del tenone
|
||||
if nLoopId then
|
||||
local dUmin, dUmax = EgtCurveDomain( nLoopId)
|
||||
for dU = dUmin, dUmax do
|
||||
local ptP = EgtUP( nLoopId, dU, GDB_ID.ROOT)
|
||||
local ptNear = EgtNP( AuxId, ptP, GDB_ID.ROOT)
|
||||
local dDist = dist( ptP, ptNear)
|
||||
if dDist > dPockL then
|
||||
dPockL = dDist
|
||||
end
|
||||
end
|
||||
-- cancello i contorni dopo averli analizzati
|
||||
for i = 1, nLoopCnt do
|
||||
EgtErase( nLoopId + i - 1)
|
||||
end
|
||||
else
|
||||
-- se il metodo sopra non funziona uso il metodo semplice (distanza tra gli angoli retti della curva tenone e faccia principale)
|
||||
local b3Aux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frTen)
|
||||
local dPockX = max( b3Ten:getMax():getX() - b3Aux:getMax():getX(), b3Aux:getMin():getX() - b3Ten:getMin():getX())
|
||||
local dPockY = max( b3Ten:getMax():getY() - b3Aux:getMax():getY(), b3Aux:getMin():getY() - b3Ten:getMin():getY())
|
||||
dPockL = sqrt( dPockX * dPockX + dPockY * dPockY)
|
||||
end
|
||||
-- abilitazione lavorazione da sotto
|
||||
local bMillUp = ( BD.DOWN_HEAD and vtExtr:getZ() > -0.259)
|
||||
local bMillDown = ( BD.DOWN_HEAD and vtExtr:getZ() < 0.1)
|
||||
|
||||
@@ -46,7 +46,7 @@ function ProcessText.Make( Proc, nPhase, nRawId, nPartId)
|
||||
return false, sErr
|
||||
end
|
||||
-- verifico che il testo non sia orientato verso il basso (-5 deg)
|
||||
if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD then
|
||||
if vtN:getZ() < - 0.1 and not BD.DOWN_HEAD and not BD.TURN then
|
||||
local sErr = 'Error on process ' .. tostring( Proc.Id) .. ' Text from bottom impossible'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
|
||||
Reference in New Issue
Block a user