Compare commits

..

70 Commits

Author SHA1 Message Date
luca.mazzoleni 09ce7d2d01 Merge branch 'develop' 2023-09-28 09:16:59 +02:00
luca.mazzoleni 84eb8ec1b9 update log 2023-09-28 09:04:29 +02:00
luca.mazzoleni a2fc9b4ade Merge remote-tracking branch 'origin/HEAD' into develop 2023-09-28 08:56:02 +02:00
Dario Sassi bb5b13d122 DataWall :
- in Is3EdgesApprox di FreeContour aggiunta cancellazione dei loop temporanei.
2023-09-27 21:06:49 +02:00
luca.mazzoleni ee04bed533 Merge branch 'master' into develop 2023-09-27 15:23:40 +02:00
luca.mazzoleni 5452ceda9f Merge branch 'develop' 2023-09-27 15:23:29 +02:00
luca.mazzoleni a875f9758b - rem compilazione FeatureTopology 2023-09-27 15:23:08 +02:00
luca.mazzoleni c091137ffc Merge branch 'master' into develop 2023-09-27 12:02:23 +02:00
luca.mazzoleni 9d0206984b Merge commit '84339a584359a77b30d2a0406482357d0930e2e4' 2023-09-27 12:00:20 +02:00
luca.mazzoleni 84339a5843 - aggiunto WFeatureTopology a Compile 2023-09-27 11:59:46 +02:00
luca.mazzoleni 780b0addc1 Merge branch 'master' into develop 2023-09-21 16:56:03 +02:00
luca.mazzoleni 6c1d2e5cc5 Merge branch 'release/2.5i3' 2023-09-21 16:53:04 +02:00
luca.mazzoleni 1c623206df update log, versione e commenti 2023-09-21 16:52:32 +02:00
luca.mazzoleni 4034898f6e - in FreeContour e Lapjoint, in MakeByMill, modificato SCC 2023-09-21 16:10:32 +02:00
luca.mazzoleni aa7099539e Merge branch 'master' into develop 2023-09-21 15:52:33 +02:00
Dario Sassi 510724a627 Merge branch 'master' of https://gitlab.steamware.net/egaltech/DataWall 2023-09-21 09:49:00 +02:00
Dario Sassi 23a831cf50 DataWall 2.5i3 :
- per pulizia corner di FreeContour disabilitato metodo con tunnel ed esteso metodo con tre punti
- in LapJoint aggiornata pulizia corner come FreeContour.
2023-09-21 09:47:27 +02:00
luca.mazzoleni b2fe513d2d Merge tag '2.5i2' into develop
Finish Release: 2.5i2
2023-09-20 10:28:30 +02:00
luca.mazzoleni 4e0a87fbf6 Merge branch 'release/2.5i2' 2023-09-20 10:28:30 +02:00
luca.mazzoleni e43afd5af4 update log 2023-09-20 10:27:59 +02:00
luca.mazzoleni 8b095a195a Merge branch 'master' into develop 2023-09-20 10:22:38 +02:00
Dario Sassi f2a066192f DataWall 2.5i2 :
- corretta impostazione allargamento aree disposizone grezzi su tavola
- in LapJoint con una sola faccia controllo lavorabilità ora come per FreeContour
- in CleanCorner ora AuxDir (SCC) sempre Z+.
2023-09-20 10:12:51 +02:00
luca.mazzoleni e59030ed4b Merge branch 'develop' 2023-09-19 18:33:58 +02:00
luca.mazzoleni a859e72707 -in FreeContour piccola correzione a alle corner milling 2023-09-19 18:29:58 +02:00
luca.mazzoleni 55050a17d2 Merge branch 'release/2.5i1' 2023-09-19 10:25:12 +02:00
luca.mazzoleni fa9a8a7e49 Merge tag '2.5i1' into develop
Finish Release: 2.5i1
2023-09-19 10:25:12 +02:00
luca.mazzoleni ff9320993c update log 2023-09-19 10:24:34 +02:00
luca.mazzoleni 9f32c5fd87 Merge remote-tracking branch 'origin/master' into develop 2023-09-12 18:29:21 +02:00
Dario Sassi 41f85808e2 DataWall 2.5i1 :
- correzioni per pulizia corner in FreeContour.
2023-09-12 11:25:15 +02:00
luca.mazzoleni f1d81ffb4d Merge tag '2.5h1' into develop
Finish Release: 2.5h1
2023-08-07 18:27:13 +02:00
luca.mazzoleni a4dcf78c9b Merge branch 'release/2.5h1' 2023-08-07 18:27:13 +02:00
luca.mazzoleni 8ddad9f183 update log e version 2023-08-07 18:27:00 +02:00
luca.mazzoleni 82b518bd54 Merge branch 'master' into develop 2023-08-07 17:08:19 +02:00
luca.mazzoleni fcd7ee98a0 update log 2023-08-07 17:08:08 +02:00
luca.mazzoleni d1fe91e68a Merge branch 'develop' 2023-08-07 17:05:39 +02:00
luca.mazzoleni b65a4e2220 In Lapjoint -> MakeSideGrooveByMill controllo testa sotto al grezzo escluso se richiesto il move after 2023-08-07 16:40:39 +02:00
luca.mazzoleni 515dbabde9 Merge branch 'release/2.5g4' 2023-08-01 14:56:10 +02:00
luca.mazzoleni ea8852115c Merge tag '2.5g4' into develop
Finish Release: 2.5g4
2023-08-01 14:56:10 +02:00
luca.mazzoleni dda6389ab2 update log e versione 2023-08-01 14:55:56 +02:00
luca.mazzoleni 69611fb9eb in ProcessLapJoint->SideGroove migliorato il controllo che la testa non scenda sotto al livello del grezzo (ora usa i diametri minimo e massimo della testa) 2023-08-01 11:39:27 +02:00
luca.mazzoleni 25a533dbf4 Merge branch 'hotfix/2.5g3H1' 2023-07-27 18:32:58 +02:00
luca.mazzoleni 3e189d6421 Merge tag '2.5g3H1' into develop
Finish Hotfix: 2.5g3H1
2023-07-27 18:32:58 +02:00
luca.mazzoleni 9bba651886 corretto bug in MachiningLib -> AddMachining che contempla il caso in cui Proc non sia una tabella 2023-07-27 18:31:58 +02:00
luca.mazzoleni e1a5625f18 Merge branch 'release/2.5g3' 2023-07-26 18:26:16 +02:00
luca.mazzoleni ff3a738d91 Merge tag '2.5g3' into develop
Finish Release: 2.5g3
2023-07-26 18:26:16 +02:00
luca.mazzoleni 8225bc93d5 update log e versione 2023-07-26 18:26:00 +02:00
luca.mazzoleni 59c9e6d1cd In Freecontour->MakeByCut migliorata la scelta della fresa secondaria in caso non sia disponibile una fresa di lunghezza sufficiente 2023-07-26 16:31:14 +02:00
luca.mazzoleni eae34681f3 In ProcessCut angolo Z minimo ora gestito tramite costante da WallData CUT_VZ_MIN (default -0.5) 2023-07-26 15:11:59 +02:00
luca.mazzoleni 098ef8deaf Merge branch 'release/2.5g2' 2023-07-26 11:39:35 +02:00
luca.mazzoleni 7f10b7219a Merge tag '2.5g2' into develop
Finish Release: 2.5g2
2023-07-26 11:39:35 +02:00
luca.mazzoleni 8cfd505f81 update log e versione 2023-07-26 11:19:26 +02:00
luca.mazzoleni 7f29b951c8 Merge branch 'feature/SideStepOnGroove' into develop 2023-07-25 18:31:11 +02:00
luca.mazzoleni 75d0d7fd13 - piccola correzione alla ricerca utensile SideGroove 2023-07-25 18:30:57 +02:00
luca.mazzoleni 808536a3aa - in LapJoint aggiunte passate laterali per SideGroove, se specificato SIDESTEP nelle note utensile
- piccole correzioni minori
2023-07-25 12:56:22 +02:00
luca.mazzoleni d959e46f50 fix commenti 2023-07-10 15:19:07 +02:00
luca.mazzoleni a156b5d703 in ProcessLapJoint->SideGroove viene ora impedito di lavorare una groove se la testa deve scendere sotto al limite superiore del grezzo 2023-07-10 15:16:01 +02:00
luca.mazzoleni fe26308388 Merge branch 'master' into develop 2023-07-04 11:26:13 +02:00
luca.mazzoleni 9846bf2598 Merge branch 'develop' 2023-07-04 11:26:01 +02:00
luca.mazzoleni d3c43fdec1 update log 2023-07-04 11:25:43 +02:00
luca.mazzoleni cb26d23639 Merge tag '2.5g1' into develop
Finish Release: 2.5g1
2023-07-04 11:23:29 +02:00
luca.mazzoleni 7b991ddc7a Merge branch 'release/2.5g1' 2023-07-04 11:23:28 +02:00
luca.mazzoleni c685b0c4c5 Merge branch 'master' into develop 2023-07-04 11:22:34 +02:00
DarioS 62d1c3cb29 DataWall 2.5g1 :
- sistemazione versione.
2023-07-04 08:53:33 +02:00
DarioS ed05f04de6 Merge branch 'master' of https://gitlab.steamware.net/egaltech/DataWall 2023-07-04 08:49:03 +02:00
DarioS aa341ed2b3 DataWall :
- modifica per posizione default del grezzo (ora assegno 0 per lasciare il compito a WD.GetOrigCorner di macchina).
2023-07-04 08:48:17 +02:00
luca.mazzoleni 18fb6622f5 Merge tag '2.5f3' into develop
Finish Release: 2.5f3
2023-06-30 16:30:34 +02:00
luca.mazzoleni 7f3aba6d1d Merge branch 'release/2.5f3' 2023-06-30 16:30:34 +02:00
luca.mazzoleni abfee0334d update log e versione 2023-06-30 16:28:40 +02:00
luca.mazzoleni e34ac566e1 -In LapJoint aggiunta lettura delle note esistenti dalle lavorazioni per evitare di sovrascriverle
- Alcune piccole correzioni
2023-06-30 16:22:17 +02:00
luca.mazzoleni 9838bc7f31 Merge tag '2.5f2' into develop
Finish Release: 2.5f2
2023-06-28 11:35:36 +02:00
8 changed files with 452 additions and 377 deletions
+2 -1
View File
@@ -1,5 +1,5 @@
REM Compilazione degli script Wall Egaltech 2023.02.27
REM Compilazione degli script Wall Egaltech 2023.09.26
REM Per togliere info di debug aggiungere flag -s prima del nome del file di input
REM Compilazione 32 e 64 bit
@@ -11,6 +11,7 @@ REM Compilazione 32 e 64 bit
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessDoubleCut.lua LuaLibs\WProcessDoubleCut.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessDrill.lua LuaLibs\WProcessDrill.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessDtMortise.lua LuaLibs\WProcessDtMortise.lua
REM \EgtProg\Dll32\luac54 -o bin\LuaLibs\WFeatureTopology.lua LuaLibs\WFeatureTopology.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessFreeContour.lua LuaLibs\WProcessFreeContour.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessLapJoint.lua LuaLibs\WProcessLapJoint.lua
\EgtProg\Dll32\luac54 -o bin\LuaLibs\WProcessMark.lua LuaLibs\WProcessMark.lua
+5 -3
View File
@@ -186,9 +186,11 @@ end
---------------------------------------------------------------------
function WMachiningLib.AddMachining( Proc, sName, sMachining)
local nMchId, sFinalName = EgtAddMachining( sName, sMachining)
local nPriority = EgtGetInfo( Proc.Id, 'PRIORITY', 'i')
EgtSetInfo( nMchId, 'PRIORITY', nPriority)
EgtSetInfo( nMchId, 'ISOUTLINE', Proc.IsOutline)
if type(Proc) == 'table' then
local nPriority = EgtGetInfo( Proc.Id or GDB_ID.NULL, 'PRIORITY', 'i')
EgtSetInfo( nMchId or GDB_ID.NULL, 'PRIORITY', nPriority)
EgtSetInfo( nMchId or GDB_ID.NULL, 'ISOUTLINE', Proc.IsOutline)
end
return nMchId, sFinalName
end
+9 -8
View File
@@ -1,5 +1,6 @@
-- WProcessCut.lua by Egaltech s.r.l. 2020/11/25
-- Gestione calcolo taglio di testa o longitudinale per Pareti
-- 2023/07/26 Angolo Z minimo ora gestito tramite costante da WallData CUT_VZ_MIN (default sempre -0.5).
-- Tabella per definizione modulo
local WPC = {}
@@ -31,7 +32,7 @@ function WPC.Classify( Proc, b3Raw)
if Proc.Fct ~= 1 then return false end
-- controllo la normale
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT)
if vtN:getZ() < - 0.5 then return false end
if vtN:getZ() < ( WD.CUT_VZ_MIN or - 0.5) then return false end
return true
end
@@ -40,29 +41,29 @@ end
-- return nFlip0, nFlip1
function WPC.FlipClassify( Proc)
-- verifico abbia una sola faccia
if Proc.Fct ~= 1 then return 0, 0 end
if Proc.Fct ~= 1 then return 0, 0 end
-- controllo la normale
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT)
local vtNZ = vtN:getZ()
if vtNZ > - GEO.EPS_SMALL then
nFlip0 = 100
elseif vtNZ < -0.5 then
elseif vtNZ < ( WD.CUT_VZ_MIN or - 0.5) then
nFlip0 = 0
else
nFlip0 = 50
end
nFlip0 = 50
end
if - vtNZ > - GEO.EPS_SMALL then
nFlip1 = 100
elseif - vtNZ < -0.5 then
elseif - vtNZ < ( WD.CUT_VZ_MIN or - 0.5) then
nFlip1 = 0
else
nFlip1 = 50
end
end
--nFlip0 = EgtIf( vtN:getZ() < -0.5, 0, 100)
--nFlip1 = EgtIf( - vtN:getZ() < -0.5, 0, 100)
return nFlip0, nFlip1
return nFlip0, nFlip1
end
---------------------------------------------------------------------
+148 -175
View File
@@ -1,4 +1,4 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2023/04/17
-- ProcessFreeContour.lua by Egaltech s.r.l. 2023/09/26
-- Gestione calcolo profilo libero per Pareti
-- 2021/11/15 Penna e chiodature sono sempre riportate sulla faccia sopra anche se nel progetto sono sotto.
-- 2021/12/10 In taglio con lama aggiunta gestione SCC per testa Gearbox.
@@ -20,6 +20,10 @@
-- 2023/04/17 Lavorazione CleanCorner sempre forzata con lato di lavoro in centro.
-- 2023/05/25 Funzioni EgtAddMachining sostituite da WM.AddMachining in modo da trascrivere le priorità da btl alle lavorazioni.
-- 2023/06/06 Aggiunta gestione lavorazione per lamatura speciale affondata con Tool_ID specifico.
-- 2023/07/26 In MakeByCut migliorata la scelta della fresa secondaria nel caso non sia disponibile una fresa di lunghezza sufficiente.
-- 2023/09/12 Modifiche a GetTunnelDimension (asse deve essere com Z globale) e MakeLocalSurf per gestire finestre con lati inclinati.
-- 2023/09/21 In MakeByMill modificato SCC per correggere caso con lama su testa fresa.
-- 2023/09/26 In Is3EdgesApprox aggiunta cancellazione dei loop temporanei.
-- Tabella per definizione modulo
local WPF = {}
@@ -543,87 +547,63 @@ local function GetFacesData( Proc, bOpposite, bCalclForBlade, dToolDiam, dToolMa
end
---------------------------------------------------------------------
local function GetTunnelDimension( nId, nPartId, nAddGrpId)
-- ottengo i versori delle 4 facce e ottengo l'orientamento del tunnel
-- recupero il numero di facce
local function GetTunnelDimension( nId, nPartId, nAddGrpId, bClosed)
-- sono necessarie almeno 2 facce
local nFacCnt = EgtSurfTmFacetCount( nId)
if nFacCnt < 2 then return end
-- recupero l'ingombro della trave
-- recupero l'ingombro del pezzo
local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
-- variabili dimensioni fessura e id faccia lunga
local dDimMin
local dDimMax
local nLongIdFace = 0
local bNegFace
local bOppoFace = false
-- ottengo il versore ortogonale
local ptN1, vtN1 = EgtSurfTmFacetCenter( nId, 0, GDB_ID.ROOT)
local vtN2 = EgtSurfTmFacetNormVersor( nId, 1, GDB_ID.ROOT)
local vtOrtho = vtN1 ^ vtN2
if vtOrtho:isSmall() then
vtN2 = EgtSurfTmFacetNormVersor( nId, 2, GDB_ID.ROOT) or V_NULL()
vtOrtho = vtN1 ^ vtN2
bOppoFace = true
-- recupero centro e normale delle facce
local ptC = {}
local vtN = {}
for i = 1, nFacCnt do
ptC[i], vtN[i] = EgtSurfTmFacetCenter( nId, i - 1, GDB_ID.ROOT)
end
if not vtOrtho:normalize() then return end
if vtOrtho:getZ() < -0.5 then
vtOrtho = -vtOrtho
bNegFace = true
-- determino l'asse medio (le facce sono già ordinate consecutivamente)
local vtAx = V_NULL()
for i = 1, EgtIf( bClosed, nFacCnt, nFacCnt - 1) do
local j = i % nFacCnt + 1
local vtOrtho = vtN[i] ^ vtN[j]
if vtOrtho:normalize() then
vtAx = vtAx + vtOrtho
end
end
-- ottengo il boundingBox e prendo le dimensioni lungo la normale (Z locale) che rappresenta la profondità della fessura
local frFc = Frame3d( ptN1, vtOrtho) ;
local bBoxLoc = EgtGetBBoxRef( nId, GDB_BB.STANDARD, frFc)
local dDepth = bBoxLoc:getDimZ()
-- mi assicuro che la Z del punto utilizzato per creare la superficie sia alla Z inferiore del bounding box locale
local ptN2 = Point3d(ptN1)
ptN2:toLoc(frFc)
ptN2 = Point3d( ptN2:getX(), ptN2:getY(), bBoxLoc:getMin():getZ() + 2*GEO.EPS_SMALL)
ptN2:toGlob(frFc)
-- creo superficie intermedia
local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, ptN2, vtOrtho, b3Solid, GDB_ID.ROOT)
if not vtAx:normalize() or abs( vtAx:getZ()) < 0.5 then return end
-- impongo come asse Z globale
vtAx = Z_AX()
-- recupero ingombro del tunnel nel riferimento globale
local b3Box = EgtGetBBoxGlob( nId, GDB_BB.STANDARD)
local dDepth = b3Box:getDimZ()
-- creo faccia in basso (di poco sollevata)
local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, b3Box:getMin() + 2 * GEO.EPS_SMALL * vtAx, vtAx, b3Solid, GDB_ID.ROOT)
if not nSurfInt then return end
-- ritaglio la superficie con le facce della fessura
for i = 1, nFacCnt do
local ptN, vtN = EgtSurfTmFacetCenter( nId, i - 1, GDB_ID.ROOT)
EgtCutSurfTmPlane( nSurfInt, ptN, -vtN, false, GDB_ID.ROOT)
end
-- sposto la geometria trovata sulla Z minima (era su di 2 * GEO.EPS_SMALL)
EgtMove( nSurfInt, Point3d(0,0,-2*GEO.EPS_SMALL) - ORIG(), GDB_RT.GLOB)
-- sposto la geometria trovata sulla Z minima del pezzo
EgtMove( nSurfInt, -2 * GEO.EPS_SMALL * vtAx, GDB_RT.GLOB)
-- mi faccio dare il contorno della superfice e la ricreo in modo più corretto
local nIdCont, nIdNum = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId)
if not nIdCont then return end
-- elimino le entità allineate dello stesso tipo
EgtMergeCurvesInCurveCompo( nIdCont, 2*GEO.EPS_SMALL)
EgtErase(nSurfInt)
nSurfInt = EgtSurfTmByFlatContour( nAddGrpId, nIdCont, 2*GEO.EPS_SMALL)
-- elimino il contorno
EgtMergeCurvesInCurveCompo( nIdCont, 2 * GEO.EPS_SMALL)
EgtErase( nSurfInt)
nSurfInt = EgtSurfTmByFlatContour( nAddGrpId, nIdCont, 2 * GEO.EPS_SMALL)
EgtErase(nIdCont)
-- se normale negativa inverto
_, vtN1 = EgtSurfTmFacetCenter( nSurfInt, 0, GDB_ID.ROOT)
if vtN1:getZ() < -0.5 then EgtInvertSurf( nSurfInt) end
local _, DimH, DimV = EgtSurfTmFacetMinAreaRectangle( nSurfInt, 0, GDB_ID.ROOT)
dDimMin = min( DimH, DimV)
dDimMax = max( DimH, DimV)
_, DimH, DimV = EgtSurfTmFacetMinAreaRectangle( nId, nFacCnt-1, GDB_ID.ROOT)
-- se faccia pari alla larghezza fessura
if abs(DimH - dDimMax) < GEO.EPS_SMALL or abs(DimV - dDimMax) < GEO.EPS_SMALL then
nLongIdFace = nFacCnt-1
-- altrimenti verifico anche con la faccia precedente
else
local nFaceToCheck = EgtIf( bOppoFace, nFacCnt-3, nFacCnt-2)
-- prendo le dimensioni della faccia e poi confronto con il minimo
_, DimH, DimV = EgtSurfTmFacetMinAreaRectangle( nId, nFaceToCheck, GDB_ID.ROOT)
-- se trovato con il minimo, questa seconda faccia non è la più lunga
if abs(DimH - dDimMin) < GEO.EPS_SMALL or abs(DimV - dDimMin) < GEO.EPS_SMALL then
nLongIdFace = nFacCnt-1
else
nLongIdFace = nFaceToCheck
-- ne recupero le dimensioni
local _, dDimMax, dDimMin = EgtSurfTmFacetMinAreaRectangle( nSurfInt, 0, GDB_ID.ROOT)
-- cerco faccia del contorno con lunghezza vicino alla massima
local nLongIdFace
for i = 1, nFacCnt do
local _, DimH, DimV = EgtSurfTmFacetMinAreaRectangle( nId, i - 1, GDB_ID.ROOT)
if DimH > dDimMax - 100 * GEO.EPS_SMALL then
nLongIdFace = i - 1
break
end
end
if not dDimMax then
return dDimMin, dDimMax, dDepth, nil, nil
end
return dDimMin, dDimMax, dDepth, vtOrtho, nLongIdFace, nSurfInt
return dDimMin, dDimMax, dDepth, vtAx, nLongIdFace, nSurfInt
end
---------------------------------------------------------------------
@@ -687,7 +667,7 @@ local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick, bC
-- in base al tipo di ripresa spigolo modifico il percorso
if nConeCut == 2 then
-- acquisisco la lunghezza utensile
sMilling, dMaxDepth = WM.FindMilling( 'CleanCorner30')
local sMilling = WM.FindMilling( 'CleanCorner30')
if not sMilling then
local sErr = 'Error : CleanCorner 30 not found in library'
return 0, sErr
@@ -720,7 +700,7 @@ local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick, bC
vtExtrExit:normalize()
-- linea intermedia (componente lunghezza utensile in direzione bisettrice)
local pEnd = ptP1 + ( dLenAdd * vtExtrExit)
nAuxId = EgtLine( nAddGrpId, ptP1, pEnd, GDB_RT.GLOB)
local nAuxId = EgtLine( nAddGrpId, ptP1, pEnd, GDB_RT.GLOB)
table.insert( nPath, nAuxId)
-- linea di ritorno
nAuxId = EgtLine( nAddGrpId, pEnd, ptP1, GDB_RT.GLOB)
@@ -749,7 +729,7 @@ local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick, bC
local dLenAdd = abs( (dMillDiam/2) / cos( nPathData[i][2]/2)) + dExtraCorner - (dMillDiam/2)
-- linea intermedia (componente lunghezza utensile in direzione bisettrice)
local pEnd = ptP1 + ( dLenAdd * vtExtrExit)
nAuxId = EgtLine( nAddGrpId, ptP1, pEnd, GDB_RT.GLOB)
local nAuxId = EgtLine( nAddGrpId, ptP1, pEnd, GDB_RT.GLOB)
table.insert( nPath, nAuxId)
-- linea di ritorno
nAuxId = EgtLine( nAddGrpId, pEnd, ptP1, GDB_RT.GLOB)
@@ -789,40 +769,28 @@ end
---------------------------------------------------------------------
local function MakeLocalSurf( ptP1, ptP2, ptP3, nAddGrpId)
-- verifico che i tre punti siano definiti
if not ptP1 or not ptP2 or not ptP3 then
return nil
end
local pAuxId = {}
local nAuxId, AuxId
nAuxId = EgtLine( nAddGrpId, ptP1, ptP2, GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
nAuxId = EgtLine( nAddGrpId, ptP2, ptP3, GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
nAuxId = EgtLine( nAddGrpId, ptP3, ptP1, GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
-- trasformo in percorso
if #pAuxId ~= 3 then
-- creo il contorno
local nLoopId = EgtCurveCompoFromPoints( nAddGrpId, { ptP1, ptP2, ptP3, ptP1}, GDB_RT.GLOB)
if not nLoopId then
return nil
end
AuxId = EgtCurveCompo( nAddGrpId, pAuxId, true)
-- se non c'é il percorso esco
if not AuxId then
return nil
end
-- creo la superfice piana
local nidFace = EgtSurfTmByFlatContour( nAddGrpId, AuxId, 0.01)
if not nidFace then
EgtErase(AuxId)
-- creo la superfice triangolare (quindi piana)
local nFaceId = EgtSurfTmByFlatContour( nAddGrpId, nLoopId, 0.01)
EgtErase( nLoopId)
if not nFaceId then
return nil
end
-- se normale negativa inverto
local _, vtN1 = EgtSurfTmFacetCenter( nidFace, 0, GDB_ID.ROOT)
if vtN1:getZ() < -0.5 then EgtInvertSurf( nidFace) end
local vtN1 = EgtSurfTmFacetNormVersor( nFaceId, 0, GDB_ID.ROOT)
if vtN1:getZ() < -0.01 then
EgtInvertSurf( nFaceId)
end
EgtErase(AuxId)
return nidFace
return nFaceId
end
---------------------------------------------------------------------
@@ -839,7 +807,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- se devo creare superfice locale
if bMakeLocSurf then
-- creo superfice locale o esco
local nSurfToAdd = MakeLocalSurf( tFacAdj[1][7], tFacAdj[1][8], tFacAdj[1][9], nAddGrpId)
local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId)
if nSurfToAdd then
local nFacCntPre = EgtSurfTmFacetCount( nNewProc)
-- creo copia del percorso principale e gli aggiungo la nuova faccia
@@ -848,7 +816,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- riordino le facce
ReorderFacesFromTab( nNewProcLoc, vFace)
-- acquisisco il numero della faccia
nFacCnt = EgtSurfTmFacetCount( nNewProcLoc)
local nFacCnt = EgtSurfTmFacetCount( nNewProcLoc)
nFacInd = nFacCnt - 1
else
return true, ''
@@ -858,28 +826,31 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
end
-- prendo il primo versore
local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT)
local _, vtN2 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[1][1], GDB_ID.ROOT)
local _, vtN3 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[1][2], GDB_ID.ROOT)
local _, vtN2 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[1], GDB_ID.ROOT)
local _, vtN3 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[2], GDB_ID.ROOT)
-- trovo il punto sulla superfice di riferimento
local _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[1][1], GDB_ID.ROOT)
local _, ptLocP3, ptLocP4, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[1][2], GDB_ID.ROOT)
local _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[1], GDB_ID.ROOT)
local _, ptLocP3, ptLocP4, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[2], GDB_ID.ROOT)
-- se ho creato faccia locale su copia superficie, cancella la copia
if bMakeLocSurf then
EgtErase( nNewProcLoc)
end
if not ptLocP1 or not ptLocP2 then
return false, 'Error : clean corner with non adjacent faces'
end
local nIdIniPoint
local nIdEndPoint
if ptLocP1 and ptLocP2 then
if ( dist( ptLocP1, tFacAdj[1][4]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[1][4]) < GEO.EPS_SMALL) then
if ( dist( ptLocP1, tFacAdj[4]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[4]) < GEO.EPS_SMALL) then
nIdEndPoint = 4
nIdIniPoint = 5
elseif ( dist( ptLocP1, tFacAdj[1][5]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[1][5]) < GEO.EPS_SMALL) then
elseif ( dist( ptLocP1, tFacAdj[5]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[5]) < GEO.EPS_SMALL) then
nIdEndPoint = 5
nIdIniPoint = 4
end
end
-- versore direzione
local vtExtr = tFacAdj[1][nIdIniPoint] - tFacAdj[1][nIdEndPoint]
local vtExtr = tFacAdj[nIdIniPoint] - tFacAdj[nIdEndPoint]
vtExtr:normalize()
-- versore direzione di uscita
local vtExtrExit
@@ -908,44 +879,44 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
vtCheck:rotate( Z_AX(), dOffsAng)
end
-- controllo se c'è collisione con le facce della superfice
if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
dTall1, dTall2, dDiam3, dTall3) then
local sErr = 'Collision detect from clean corner tool and surface'
EgtOutLog( sErr)
return true, ''
end
nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdIniPoint], tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdIniPoint], tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
-- se uso utensile cono 60°
if nTypeConeCut == 1 then
-- se offset angolare valido e/o negativo creo il baffo precedente
if dOffsAng < ( 100 * GEO.EPS_SMALL) then
-- se il punto finale corrisponde con il punto utilizzato in precedenza, uso l'altro
if dist( tFacAdj[1][nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then
if dist( tFacAdj[nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then
ptApPoint = ptLocP2
else
ptApPoint = ptLocP1
end
nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
local dLenTrimExt = dist( tFacAdj[1][nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 0.2)
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
local dLenTrimExt = dist( tFacAdj[nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 0.2)
-- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta
if dLenTrimExt > 10 * GEO.EPS_SMALL then
EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
end
-- prendo il nuovo punto finale
ptApPoint = EgtEP( nAuxId, GDB_RT.GLOB) + Point3d( 0, 0, dDepthMach)
else
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
end
end
table.insert( pAuxId, nAuxId)
-- creo linea di ritorno
nAuxId = EgtLine( nAddGrpId, ptApPoint + Point3d( 0, 0, -dDepthMach), tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
nAuxId = EgtLine( nAddGrpId, ptApPoint + Point3d( 0, 0, -dDepthMach), tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
end
end
@@ -955,7 +926,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
ptLocP1, ptLocP2 = ptLocP3, ptLocP4
if ptLocP1 and ptLocP2 then
-- se il punto finale corrisponde con il punto utilizzato in precedenza, uso l'altro
if dist( tFacAdj[1][nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then
if dist( tFacAdj[nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then
ptApPoint = ptLocP2
else
ptApPoint = ptLocP1
@@ -964,36 +935,36 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
if nTypeConeCut == 1 then
-- se offset angolare valido e/o negativo creo il baffo precedente
if dOffsAng > -( 100 * GEO.EPS_SMALL) then
nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
local dLenTrimExt = dist( tFacAdj[1][nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 0.2)
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
local dLenTrimExt = dist( tFacAdj[nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 0.2)
-- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta
if dLenTrimExt > 10 * GEO.EPS_SMALL then
EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
end
-- prendo il nuovo punto finale
ptApPoint = EgtEP( nAuxId, GDB_RT.GLOB) + Point3d( 0, 0, dDepthMach)
else
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
end
end
table.insert( pAuxId, nAuxId)
-- creo linea di ritorno
nAuxId = EgtLine( nAddGrpId, ptApPoint + Point3d( 0, 0, -dDepthMach), tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
nAuxId = EgtLine( nAddGrpId, ptApPoint + Point3d( 0, 0, -dDepthMach), tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
end
-- ultima linea di distacco (5mm in direzione utensile)
local pEnd = tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach) + ( 5 * vtExtr)
nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), pEnd, GDB_RT.GLOB)
local pEnd = tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach) + ( 5 * vtExtr)
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), pEnd, GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
else
-- linea di distacco (2mm in direzione utensile)
local pEnd = tFacAdj[1][nIdEndPoint] + ( 2 * vtExtr)
nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint], pEnd, GDB_RT.GLOB)
local pEnd = tFacAdj[nIdEndPoint] + ( 2 * vtExtr)
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdEndPoint], pEnd, GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
-- ultima linea di risalita in Z
local pIni = pEnd
@@ -1016,7 +987,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
EgtModifyCurveExtrusion( AuxId, vtExtr, GDB_RT.GLOB)
-- se ho un offset angolare ruoto il percorso
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
EgtRotate( AuxId, tFacAdj[1][nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
end
-- inserisco la lavorazione
local sName = 'Clean_' .. ( EgtGetName( nNewProc) or tostring( nNewProc))
@@ -1034,10 +1005,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_YM
if vtExtr:getY() > 100 * GEO.EPS_ZERO then
nSCC = MCH_SCC.ADIR_YP
end
local nSCC = MCH_SCC.ADIR_ZP
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, 0)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 4)
@@ -1110,9 +1078,11 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
dToolLength = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dToolLength
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth -- qui è la distanza dal portautensile
-- calcolo il secondo diametro del cono
dMillTotDiam = dMillDiam + ( abs(dThickTool) * tan(dSideAng)) * 2
dMillTotDiam = dMillDiam + ( abs( dThickTool) * tan( dSideAng)) * 2
end
end
-- verifico se ciclo chiuso
local bClosed = ( abs( vFace[1].PrevAng) > 0.1)
-- copio la feature nel layer di appoggio
local nNewProc
if nMasterNewProc then
@@ -1121,31 +1091,27 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
end
local nFacCnt = EgtSurfTmFacetCount( nNewProc)
local nFacInd, dDimMin, dDimMax, dDepth, nSurfInt
local nFacInd, dDepth, nSurfInt
local bMakeLocSurf
if nFacCnt <= 4 then
-- ottengo le dimensioni apertura, la normale e la faccia inferiore
dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId)
-- RIMUOVERE
if false and nFacCnt <= 4 then
-- recupero profondità e faccia di fondo
_, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId, bClosed)
if nSurfInt then
-- uso la dimensione minima anche nel caso che la cava sborda perchè la lavorazione potrebbe collidere con un pezzo limitrofo
local dMinWidth = dDimMin
nNewProc = EgtSurfTmBySewing( nAddGrpId, {nNewProc,nSurfInt} , true)
-- aggiungo la faccia di fondo appena calcolata
nNewProc = EgtSurfTmBySewing( nAddGrpId, { nNewProc, nSurfInt}, true)
-- riordino le facce
ReorderFacesFromTab( nNewProc, vFace)
-- acquisisco il numero della faccia
-- aggiorno numero di facce e assegno indice di quella di fondo (sempre ultima)
nFacCnt = EgtSurfTmFacetCount( nNewProc)
nFacInd = nFacCnt - 1
else
return true
--local sErr = 'Error : cannot create base surface'
--EgtOutLog( sErr)
--return false, sErr
end
-- FINE PARTE DA RIMUOVERE
else
bMakeLocSurf = true
end
-- verifico se ciclo chiuso
local bClosed = ( abs( vFace[1].PrevAng) > 0.1)
-- ciclo di inserimento delle fresate sulle facce del contorno in esame
local i = 1
-- se faccia finale con fine non lavorato, forzo partenza da prima faccia non tutta saltata (tipo 4)
@@ -1160,38 +1126,37 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
while i <= #vFace do
-- se tutta la faccia o la sua fine senza taglio, inserisco una fresatura
if ( vFace[i].Type & 2) ~= 0 or vFace[i].Type == 4 then
-- variabili costruzione geometria
local tFacAdj = {}
-- variabili costruzione geometria (nFace1, nFace2, tFacAdj)
local nFace1 = vFace[i].Fac
local nFace2
-- aggiungo geometria
local j = EgtIf( i < #vFace, i + 1, EgtIf( bClosed, 1, nil))
if not j then return true end
local nFace2 = vFace[j].Fac
-- ricavo i tre punti per eventuale superficie locale
local ptLoc1, ptLoc2, ptLoc3
-- punto precedente (punto precedente della faccia [i])
ptLoc3 = vFace[i].PPrev
-- aggiungo geometria
i = i + 1
local j = EgtIf( i <= #vFace, i, EgtIf( bClosed, 1, nil))
if not j then
return true
end
nFace2 = vFace[j].Fac
-- punto in comune tra le due facce (punto precedente della faccia [j])
ptLoc1 = vFace[j].PPrev
-- punto precedente (punto precedente della faccia [i])
if vFace[i].PPrev then
ptLoc3 = vFace[i].PPrev
else
ptLoc3 = Point3d( vFace[i].Cen:getX(), vFace[i].Cen:getY(), ptLoc1:getZ())
end
-- punto successivo ( precedente della faccia successiva)
j = j + 1
local k = EgtIf( j <= #vFace, j, EgtIf( bClosed, 1, nil))
local k = EgtIf( j < #vFace, j + 1, EgtIf( bClosed, 1, nil))
-- se è un percorso aperto prendo il punto medio della seconda faccia come punto locale 2
if not k then
ptLoc2 = Point3d( vFace[j-1].Cen:getX(), vFace[j-1].Cen:getY(), ptLoc1:getZ())
ptLoc2 = Point3d( vFace[j].Cen:getX(), vFace[j].Cen:getY(), ptLoc1:getZ())
else
ptLoc2 = vFace[k].PPrev
end
-- ricavo i punti e l'angolo interno
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT)
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
local tFacAdj = {}
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then
local dLen = dist( ptP1, ptP2)
table.insert( tFacAdj, { nFace1, nFace2, dLen, ptP1, ptP2, dAng, ptLoc1, ptLoc2, ptLoc3})
tFacAdj = { nFace1, nFace2, dLen, ptP1, ptP2, dAng, ptLoc1, ptLoc2, ptLoc3}
end
-- se ho un elemento creo percorso o percorsi in base al tipo di cono e all'apertura dall'angolo rispetto ai 90°
-- con una tolleranza di 2 gradi
@@ -1219,9 +1184,9 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
if not bOk then return bOk, sErr end
end
end
else
i = i + 1
end
-- passo alla successiva
i = i + 1
end
-- cancello la copia della superfice
if nNewProc then
@@ -1246,26 +1211,28 @@ end
---------------------------------------------------------------------
-- Funzione per determinare se la faccia ha lati molto corti (trascurabili) ed è quindi approssimabile ad una 3 facce
local function Is3EdgesApprox( Proc, nFacet, nAddGrpId)
local bResult = false
local nContourId = EgtExtractSurfTmFacetLoops( Proc.Id, nFacet, nAddGrpId)
nAddGrpId = nAddGrpId or WL.GetAddGroup( Proc.PartId)
-- recupero il contorno della faccia
local nContourId, nContourCnt = EgtExtractSurfTmFacetLoops( Proc.Id, nFacet, nAddGrpId)
if not nContourId then return false end
EgtMergeCurvesInCurveCompo( nContourId)
-- recupero il numero effettivo di lati
-- recupero il numero di lati del contorno
local _, nEntityCount = EgtCurveDomain( nContourId)
if not nEntityCount then return false end
-- se sono già tre, ho finito
if nEntityCount == 3 then return true end
-- rimuovo i lati molto corti dal conteggio totale
local nEdges = nEntityCount
if nContourId then
if nEntityCount and nEntityCount == 3 then
bResult = true
-- rimuovo i lati molto corti dal conteggio totale
elseif nEntityCount then
for i = 1, nEntityCount do
local dLength = EgtCurveCompoLength( nContourId, i - 1)
if dLength < 15 then nEdges = nEdges - 1 end
end
end
if nEdges == 3 then bResult = true end
for i = 1, nEntityCount do
local dLength = EgtCurveCompoLength( nContourId, i - 1)
if dLength < 15 then nEdges = nEdges - 1 end
end
if bResult == true then
EgtOutLog( 'FreeContour : Face with ' .. tointeger( nEntityCount) .. ' edges skipped (approx 3 edges)')
-- verifico il numero significativo di lati
local bResult = ( nEdges == 3)
-- cancello tutti i contorni appena creati
EgtErase( EgtTableFill( nContourId, nContourCnt))
if bResult then
EgtOutLog( 'FreeContour : Face with ' .. tostring( nEntityCount) .. ' edges skipped (approx 3 edges)')
end
return bResult
end
@@ -1999,7 +1966,13 @@ local function MakeByCut( Proc, nRawId, b3Raw)
local sMilling, dMillMaxDepth = WM.FindMilling( 'FreeContour', dMaxWidth + WD.CUT_EXTRA, nil, nil, nil, nil, true)
local sMilling2 = WM.FindMilling( 'FreeContour', nil, nil, nil, nil, nil, true)
if not sMilling and ( not sSawing or bSlanting) then
sMilling = sMilling2
-- se non trovo una fresa di lunghezza sufficiente, prendo la più lunga disponibile
local sMillingMaxLength = WM.FindMilling( 'FreeContour', 0.8 * ( dMaxWidth + WD.CUT_EXTRA), nil, nil, nil, nil, true) or
WM.FindMilling( 'FreeContour', 0.6 * ( dMaxWidth + WD.CUT_EXTRA), nil, nil, nil, nil, true) or
WM.FindMilling( 'FreeContour', 0.4 * ( dMaxWidth + WD.CUT_EXTRA), nil, nil, nil, nil, true) or
WM.FindMilling( 'FreeContour', 0.2 * ( dMaxWidth + WD.CUT_EXTRA), nil, nil, nil, nil, true) or
WM.FindMilling( 'FreeContour', nil, nil, nil, nil, nil, true)
sMilling = sMillingMaxLength
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
@@ -2221,7 +2194,7 @@ local function MakeByMill( Proc, nRawId, b3Raw)
-- 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)
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XM)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
@@ -2442,7 +2415,7 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
return MakeByMill( Proc, nRawId, b3Raw)
end
-- se la faccia di fondo ha confini aperti, devo lavorarla direttamente
vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1] or {}
local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1] or {}
for i = 1, #vAdj do
if vAdj[i] == - 1 then
bPocketBotface = true
+250 -184
View File
@@ -1,4 +1,4 @@
-- WProcessLapJoint.lua by Egaltech s.r.l. 2023/04/17
-- WProcessLapJoint.lua by Egaltech s.r.l. 2023/09/21
-- Gestione calcolo mezzo-legno per Pareti
-- 2021/08/27 DS Se tre o più facce con flag PCKT=1 forzo svuotatura con fresa (per Variant).
-- 2021/08/29 DS Se svuotatura di fianco setto flag per farla dopo i tagli.
@@ -21,6 +21,14 @@
-- 2023/04/17 Sistemata gestione parametri Q, eliminando quello non usato di forzatura lama e abilitandoli anche per DoubleCut.
-- Lavorazione CleanCorner sempre forzata con lato di lavoro in centro.
-- 2023/05/25 Funzioni EgtAddMachining sostituite da WM.AddMachining in modo da trascrivere le priorità da btl alle lavorazioni.
-- 2023/06/30 Aggiunta lettura delle note esistenti dalle lavorazioni per evitare di sovrascriverle.
-- 2023/07/10 In MakeSideGrooveByMill si impedisce ora di lavorare una groove se la testa deve scendere sotto al limite superiore del grezzo.
-- 2023/07/25 Aggiunte passate laterali per SideGroove, se specificato SIDESTEP nelle note utensile.
-- 2023/08/01 Migliorato controllo testa sotto al grezzo in SieGroove.
-- 2023/08/07 Controllo testa sotto al grezzo in SideGroove escluso se richiesto il move after.
-- 2023/09/19 Controllo lavorabilità con una sola faccia ora ha limiti come FreeContour.
-- 2023/09/21 Modifica controllo lavorabilità con tre facce tipo tunnel ma non ortogonali tra loro.
-- 2023/09/21 In MakeByMill modificato SCC per correggere caso con lama su testa fresa.
-- Tabella per definizione modulo
local WPL = {}
@@ -108,8 +116,8 @@ function WPL.Classify( Proc, b3Raw)
if Proc.Fct == 1 then
-- dati della faccia
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT)
-- verifico se è lavorabile da sopra
return vtN:getZ() >= WD.NZ_MINA
-- verifico se è lavorabile da sopra o di fianco
return vtN:getZ() >= -0.5
-- se 2 facce
elseif Proc.Fct == 2 then
-- dati delle facce
@@ -117,7 +125,7 @@ function WPL.Classify( Proc, b3Raw)
vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT)
vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT)
-- verifico se è lavorabile da sopra o di fianco
return ( vtN[1]:getZ() >= - 0.028 or vtN[2]:getZ() >= - 0.028)
return ( vtN[1]:getZ() >= -0.028 or vtN[2]:getZ() >= -0.028)
-- se più di 2 facce
else
local nFacInd, dElev, nFacInd2, dElev2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
@@ -186,8 +194,8 @@ function WPL.Classify( Proc, b3Raw)
else
return false
end
-- se altrimenti tunnel
elseif nFacInd == -1 then
-- se altrimenti tunnel o assimilabile
elseif nFacInd == -1 or nFacInd == -2 then
-- dati delle prime tre facce
local vtN = {}
vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT)
@@ -802,7 +810,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- se devo creare superfice locale
if bMakeLocSurf then
-- creo superfice locale o esco
local nSurfToAdd = MakeLocalSurf( tFacAdj[1][7], tFacAdj[1][8], tFacAdj[1][9], nAddGrpId)
local nSurfToAdd = MakeLocalSurf( tFacAdj[7], tFacAdj[8], tFacAdj[9], nAddGrpId)
if nSurfToAdd then
local nFacCntPre = EgtSurfTmFacetCount( nNewProc)
-- creo copia del percorso principale e gli aggiungo la nuova faccia
@@ -811,7 +819,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- riordino le facce
nNewProcLoc = ReorderFacesFromTab( nNewProcLoc, vFace)
-- acquisisco il numero della faccia
nFacCnt = EgtSurfTmFacetCount( nNewProcLoc)
local nFacCnt = EgtSurfTmFacetCount( nNewProcLoc)
nFacInd = nFacCnt - 1
else
local sErr = 'Cannot make local bottom surface'
@@ -823,11 +831,11 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
end
-- prendo il primo versore
local _, vtN1 = EgtSurfTmFacetCenter( nNewProcLoc, nFacInd, GDB_ID.ROOT)
local _, vtN2 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[1][1], GDB_ID.ROOT)
local _, vtN3 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[1][2], GDB_ID.ROOT)
local _, vtN2 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[1], GDB_ID.ROOT)
local _, vtN3 = EgtSurfTmFacetCenter( nNewProcLoc, tFacAdj[2], GDB_ID.ROOT)
-- trovo il punto sulla superfice di riferimento
local _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[1][1], GDB_ID.ROOT)
local _, ptLocP3, ptLocP4, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[1][2], GDB_ID.ROOT)
local _, ptLocP1, ptLocP2, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[1], GDB_ID.ROOT)
local _, ptLocP3, ptLocP4, _ = EgtSurfTmFacetsContact( nNewProcLoc, nFacInd, tFacAdj[2], GDB_ID.ROOT)
-- se ho creato faccia locale su copia superficie, cancella la copia
if bMakeLocSurf then
EgtErase( nNewProcLoc)
@@ -835,16 +843,16 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
local nIdIniPoint
local nIdEndPoint
if ptLocP1 and ptLocP2 then
if ( dist( ptLocP1, tFacAdj[1][4]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[1][4]) < GEO.EPS_SMALL) then
if ( dist( ptLocP1, tFacAdj[4]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[4]) < GEO.EPS_SMALL) then
nIdEndPoint = 4
nIdIniPoint = 5
elseif ( dist( ptLocP1, tFacAdj[1][5]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[1][5]) < GEO.EPS_SMALL) then
elseif ( dist( ptLocP1, tFacAdj[5]) < GEO.EPS_SMALL) or ( dist( ptLocP2, tFacAdj[5]) < GEO.EPS_SMALL) then
nIdEndPoint = 5
nIdIniPoint = 4
end
end
-- versore direzione
local vtExtr = tFacAdj[1][nIdIniPoint] - tFacAdj[1][nIdEndPoint]
local vtExtr = tFacAdj[nIdIniPoint] - tFacAdj[nIdEndPoint]
vtExtr:normalize()
-- versore direzione di uscita
local vtExtrExit
@@ -873,44 +881,44 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
vtCheck:rotate( Z_AX(), dOffsAng)
end
-- controllo se c'è collisione con le facce della superfice
if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
if nTypeConeCut == 1 and CalcInterference( nNewProc, vtCheck, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), dDiam1, dDiam2,
dTall1, dTall2, dDiam3, dTall3) then
local sErr = 'Collision detect from clean corner tool and surface'
EgtOutLog( sErr)
return true, ''
end
nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdIniPoint], tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdIniPoint], tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
-- se uso utensile cono 60°
if nTypeConeCut == 1 then
-- se offset angolare valido e/o negativo creo il baffo precedente
if dOffsAng < ( 100 * GEO.EPS_SMALL) then
-- se il punto finale corrisponde con il punto utilizzato in precedenza, uso l'altro
if dist( tFacAdj[1][nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then
if dist( tFacAdj[nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then
ptApPoint = ptLocP2
else
ptApPoint = ptLocP1
end
nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
local dLenTrimExt = dist( tFacAdj[1][nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 0.2)
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
local dLenTrimExt = dist( tFacAdj[nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 0.2)
-- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta
if dLenTrimExt > 10 * GEO.EPS_SMALL then
EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
end
-- prendo il nuovo punto finale
ptApPoint = EgtEP( nAuxId, GDB_RT.GLOB) + Point3d( 0, 0, dDepthMach)
else
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
end
end
table.insert( pAuxId, nAuxId)
-- creo linea di ritorno
nAuxId = EgtLine( nAddGrpId, ptApPoint + Point3d( 0, 0, -dDepthMach), tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
nAuxId = EgtLine( nAddGrpId, ptApPoint + Point3d( 0, 0, -dDepthMach), tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
end
end
@@ -920,7 +928,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
ptLocP1, ptLocP2 = ptLocP3, ptLocP4
if ptLocP1 and ptLocP2 then
-- se il punto finale corrisponde con il punto utilizzato in precedenza, uso l'altro
if dist( tFacAdj[1][nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then
if dist( tFacAdj[nIdEndPoint], ptLocP1) < 10 * GEO.EPS_SMALL then
ptApPoint = ptLocP2
else
ptApPoint = ptLocP1
@@ -929,36 +937,36 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
if nTypeConeCut == 1 then
-- se offset angolare valido e/o negativo creo il baffo precedente
if dOffsAng > -( 100 * GEO.EPS_SMALL) then
nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
local dLenTrimExt = dist( tFacAdj[1][nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 0.2)
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
local dLenTrimExt = dist( tFacAdj[nIdEndPoint], ptApPoint) - (( dToolDiam/2) + 0.2)
-- se la distanza dei due punti della linea è maggiore dal raggio fresa + delta, trimmo al raggio fresa + delta
if dLenTrimExt > 10 * GEO.EPS_SMALL then
EgtTrimExtendCurveByLen( nAuxId , -dLenTrimExt, ptApPoint + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
end
-- prendo il nuovo punto finale
ptApPoint = EgtEP( nAuxId, GDB_RT.GLOB) + Point3d( 0, 0, dDepthMach)
else
-- se ho l'offset angolare ruoto la linea per compensare la rotazione che verrà applicata
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
EgtRotate( nAuxId, tFacAdj[1][nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
EgtRotate( nAuxId, tFacAdj[nIdEndPoint], Z_AX(), -dOffsAng, GDB_RT.GLOB)
end
end
table.insert( pAuxId, nAuxId)
-- creo linea di ritorno
nAuxId = EgtLine( nAddGrpId, ptApPoint + Point3d( 0, 0, -dDepthMach), tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
nAuxId = EgtLine( nAddGrpId, ptApPoint + Point3d( 0, 0, -dDepthMach), tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
end
-- ultima linea di distacco (5mm in direzione utensile)
local pEnd = tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach) + ( 5 * vtExtr)
nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint] + Point3d( 0, 0, -dDepthMach), pEnd, GDB_RT.GLOB)
local pEnd = tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach) + ( 5 * vtExtr)
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdEndPoint] + Point3d( 0, 0, -dDepthMach), pEnd, GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
else
-- linea di distacco (2mm in direzione utensile)
local pEnd = tFacAdj[1][nIdEndPoint] + ( 2 * vtExtr)
nAuxId = EgtLine( nAddGrpId, tFacAdj[1][nIdEndPoint], pEnd, GDB_RT.GLOB)
local pEnd = tFacAdj[nIdEndPoint] + ( 2 * vtExtr)
nAuxId = EgtLine( nAddGrpId, tFacAdj[nIdEndPoint], pEnd, GDB_RT.GLOB)
table.insert( pAuxId, nAuxId)
-- ultima linea di risalita in Z
local pIni = pEnd
@@ -981,7 +989,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
EgtModifyCurveExtrusion( AuxId, vtExtr, GDB_RT.GLOB)
-- se ho un offset angolare ruoto il percorso
if abs(dOffsAng) > 100 * GEO.EPS_SMALL then
EgtRotate( AuxId, tFacAdj[1][nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
EgtRotate( AuxId, tFacAdj[nIdEndPoint], Z_AX(), dOffsAng, GDB_RT.GLOB)
end
-- inserisco la lavorazione
local sName = 'Clean_' .. ( EgtGetName( nNewProc) or tostring( nNewProc))
@@ -999,10 +1007,7 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_YM
if vtExtr:getY() > 100 * GEO.EPS_ZERO then
nSCC = MCH_SCC.ADIR_YP
end
local nSCC = MCH_SCC.ADIR_ZP
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
EgtSetMachiningParam( MCH_MP.LEADINTYPE, 0)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, 4)
@@ -1013,10 +1018,13 @@ local function AddMillCornerMachining( nPartId, nNewProc, nFacInd, tFacAdj, nTyp
EgtSetMachiningParam( MCH_MP.DEPTH, 0)
-- forzo lato correzione a centrato
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER)
-- leggo eventuali note esistenti della lavorazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill
local sUserNotes = 'VMRS=0;'
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
-- aggiungo alle note massima elevazione
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( 0.0, 1) .. ';'
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( 0.0, 1))
-- scrivo le note della lavorazione
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -1088,7 +1096,8 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
local nFacCnt = EgtSurfTmFacetCount( nNewProc)
local nFacInd, dDimMin, dDimMax, dDepth, nSurfInt
local bMakeLocSurf
if nFacCnt <= 4 then
-- RIMUOVERE
if false and nFacCnt <= 4 then
-- ottengo le dimensioni apertura, la normale e la faccia inferiore
dDimMin, dDimMax, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId)
if nSurfInt then
@@ -1105,6 +1114,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
EgtOutLog( sErr)
return false, sErr
end
-- FINE PARTE DA RIMUOVERE
else
bMakeLocSurf = true
end
@@ -1124,38 +1134,37 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
while i <= #vFace do
-- se tutta la faccia o la sua fine senza taglio, inserisco una fresatura
if ( vFace[i].Type & 2) ~= 0 or vFace[i].Type == 4 then
-- variabili costruzione geometria
local tFacAdj = {}
-- variabili costruzione geometria (nFace1, nFace2, tFacAdj)
local nFace1 = vFace[i].Fac
local nFace2
-- ricavo i tre punti per eventuale superficie locale
local ptLoc1, ptLoc2, ptLoc3
-- punto precedente (punto precedente della faccia [i])
ptLoc3 = vFace[i].PPrev
-- aggiungo geometria
i = i + 1
local j = EgtIf( i <= #vFace, i, EgtIf( bClosed, 1, nil))
if not j then
return true
end
nFace2 = vFace[j].Fac
local j = EgtIf( i < #vFace, i + 1, EgtIf( bClosed, 1, nil))
if not j then return true end
local nFace2 = vFace[j].Fac
-- punto in comune tra le due facce (punto precedente della faccia [j])
ptLoc1 = vFace[j].PPrev
-- punto precedente (punto precedente della faccia [i])
if vFace[i].PPrev then
ptLoc3 = vFace[i].PPrev
else
ptLoc3 = Point3d( vFace[i].Cen:getX(), vFace[i].Cen:getY(), ptLoc1:getZ())
end
-- punto successivo ( precedente della faccia successiva)
j = j + 1
local k = EgtIf( j <= #vFace, j, EgtIf( bClosed, 1, nil))
local k = EgtIf( j < #vFace, j + 1, EgtIf( bClosed, 1, nil))
-- se è un percorso aperto prendo il punto medio della seconda faccia come punto locale 2
if not k then
ptLoc2 = Point3d( vFace[j-1].Cen:getX(), vFace[j-1].Cen:getY(), ptLoc1:getZ())
ptLoc2 = Point3d( vFace[j].Cen:getX(), vFace[j].Cen:getY(), ptLoc1:getZ())
else
ptLoc2 = vFace[k].PPrev
end
-- ricavo i punti e l'angolo interno
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFace1, nFace2, GDB_ID.ROOT)
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
local tFacAdj = {}
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > EgtIf( nTypeConeCut == 1, -(90 + 10 * GEO.EPS_SMALL), -(180-dAngleSmall + 10 * GEO.EPS_SMALL)) then
local dLen = dist( ptP1, ptP2)
table.insert( tFacAdj, { nFace1, nFace2, dLen, ptP1, ptP2, dAng, ptLoc1, ptLoc2, ptLoc3})
tFacAdj = { nFace1, nFace2, dLen, ptP1, ptP2, dAng, ptLoc1, ptLoc2, ptLoc3}
end
-- se ho un elemento creo percorso o percorsi in base al tipo di cono e all'apertura dall'angolo rispetto ai 90°
-- con una tolleranza di 2 gradi
@@ -1183,9 +1192,9 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
if not bOk then return bOk, sErr end
end
end
else
i = i + 1
end
-- passo alla successiva
i = i + 1
end
-- cancello la copia della superfice
if nNewProc then
@@ -1302,13 +1311,16 @@ local function MakeByChainSaw( Proc, nFacet, nRawId, b3Raw, dElev, dH, dV)
-- se necessario, limito l'affondamento
if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then
sWarn = 'Warning in LapJoint : elevation (' .. EgtNumToString( dElev, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
dDepth = dMaxDepth - dElev
local dDepth = dMaxDepth - dElev
EgtOutLog( sWarn)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH '..EgtNumToString( dDepth, 1))
end
-- leggo eventuali note esistenti della lavorazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
-- imposto elevazione
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 2) .. ';'
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 2))
-- scrivo le note della lavorazione
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -1390,7 +1402,7 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_ZP
if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XM)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto modo di lavorare la faccia
@@ -1436,6 +1448,8 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
EgtOutLog( sErr)
return false, sErr
end
local dGrooveMinZ = max( b3Raw:getMin():getZ(), Proc.Box:getMin():getZ())
local dRawMaxZ = b3Raw:getMax():getZ()
-- recupero i dati dell'utensile
local dMillDiam = 20
local dMillLen = 10
@@ -1444,6 +1458,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
local dMillDiamTh = 999
local dMillDiamThStem = 0
local dMillLenTh = 0
local dSideStep = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
@@ -1454,6 +1469,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
dMillDiamTh = EgtTdbGetCurrToolThDiam() or dMillDiamTh
dMillDiamThStem = EgtTdbGetCurrToolParam( MCH_TP.STEMDIAM) or dMillDiamThStem
dMillLenTh = EgtTdbGetCurrToolThLength() or dMillLenTh
dSideStep = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDESTEP', 'd') or dSideStep
if ( EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE) ~= 0 then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dMaxMat
if not dMaxDepthOnSide or dMaxDepthOnSide < 0.1 then
@@ -1465,8 +1481,6 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
dMaxDepthOnSide = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd')
end
end
local dGrooveMinZ = max( b3Raw:getMin():getZ(), Proc.Box:getMin():getZ())
local dRawMaxZ = b3Raw:getMax():getZ()
-- se riesco a lavorare il sottosquadro senza arrivare alla parte larga del portautensile uso la sidedepth o il diametro stretto del portautensile come diametro del gambo
if ( dMillTotLen - dMillLenTh) > ( abs( dRawMaxZ - dGrooveMinZ) + 1) then
if dMaxDepthOnSide and dMaxDepthOnSide > 0 then
@@ -1478,7 +1492,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
end
end
-- se profondità ribasso è maggiore della capacità di sottosquadro dell'utensile
if ( not bEnablePreMill and bMachFromDn) and ( dElev >= ( 0.5 * ( dMillDiam - dMillDiamTh))) then
if ( not bEnablePreMill and bMachFromDn) and ( dElev > 0.5 * ( dMillDiam - dMillDiamTh) - 10 * GEO.EPS_SMALL) then
local sErr = 'Error : Side Elevation (' .. dElev .. ') bigger than max tool side depth (' .. ( 0.5 * ( dMillDiam - dMillDiamTh)) ..')'
EgtOutLog( sErr)
return false, sErr
@@ -1490,7 +1504,20 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
return false, sErr
end
if Proc.Fct == 2 and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + 100 * GEO.EPS_SMALL and dMaxMat > dThick + 10 * GEO.EPS_SMALL then
local sErr = 'Error : Tool thickness is too big'
local sErr = 'Error : Tool thickness is too big'
EgtOutLog( sErr)
return false, sErr
end
-- dimensioni della testa
local dHeadMaxWidth = 250
local dHeadMinWidth = 160
local dHeadMinWidthHeight = 30
-- se la testa scende sotto al limite superiore del grezzo e non c'è sufficiente capacità di sottosquadro
-- controllo disattivato se move after
if WD.SIDEMILL_BEFORE and not ( bEnablePreMill or bAsEnablePreMill) and
( ( dMillTotLen < ( abs( dRawMaxZ - dGrooveMinZ) + 10 * GEO.EPS_SMALL) and ( dElev > 0.5 * ( dMillDiam - dHeadMinWidth) - 10 * GEO.EPS_SMALL)) or
( dMillTotLen + dHeadMinWidthHeight < ( abs( dRawMaxZ - dGrooveMinZ) + 10 * GEO.EPS_SMALL) and ( dElev > 0.5 * ( dMillDiam - dHeadMaxWidth) - 10 * GEO.EPS_SMALL))) then
local sErr = 'Error : Tool too short, head will collide with rawpart'
EgtOutLog( sErr)
return false, sErr
end
@@ -1732,7 +1759,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
end
end
-- inserisco la lavorazione di fresatura
local sNameGorge = 'Gorge_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. tostring( nFacet) .. '_' .. tostring( nNm)
local sNameGorge = 'Gorge_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. tostring( nFacet)
local nMchFId = WM.AddMachining( Proc, sNameGorge, sMillingGorge)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameGorge .. '-' .. sMillingGorge
@@ -1748,7 +1775,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto modo di lavorare la faccia
local nFaceUse = WL.GetNearestParalOpposite( Z_AX(), vtN)
local nFaceUse = WL.GetNearestParalOpposite( Z_AX())
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto elevazione e step
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
@@ -1783,7 +1810,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
for i = 1, nNumStep - 1 do
nNm = nNm + 1
-- inserisco la lavorazione di taglio sfrido gorge
local sNameGorge = 'GorgeCut_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. tostring( nFacet) .. '_' .. tostring( nNm)
local sNameGorge = 'GorgeCut_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. tostring( nFacet) .. '_' .. tostring( nNm)
local nMchFId = WM.AddMachining( Proc, sNameGorge, sCuttingGorge)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameGorge .. '-' .. sCuttingGorge
@@ -1841,121 +1868,147 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
local dStepOri
if not bExcludeSideMill then
-- inserisco la lavorazione di ribasso o gola
local sName = EgtIf( bEnablePreMill ~= nil, 'SideMill_', 'Mill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = WM.AddMachining( Proc, sName, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
local nSideStep = 1
if dSideStep > 0 and not ( bEnablePreMill or bAsEnablePreMill) and nModifyLeadInOut < 1 then
nSideStep = ceil( dElev / dSideStep)
dSideStep = max( dElev / nSideStep, 0)
end
EgtSetInfo( nMchFId, 'Part', Proc.PartId)
-- se ho abilitato la lavorazione di lama per garantire passaggio utensile, setto la nota per spostare la fresatura dopo i tagli di lama
if bEnablePreMill or bAsEnablePreMill then
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nFacet}})
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_NEAR
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto modo di lavorare la faccia
local nFaceUse = WL.GetNearestParalOpposite( Z_AX(), vtN)
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto elevazione e step
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
dStepOri = dStep
if dStep < GEO.EPS_SMALL then dStep = 0.75 * dMaxMat end
local nStep = ceil( ( dThick - dMaxMat) / dStep)
dStep = max( ( dThick - dMaxMat) / max( nStep, 1), 0)
local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0)
if nSinglePass and nSinglePass > 0 then
dStep = 0
if nSinglePass == 1 then
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
for i = 1, nSideStep do
-- inserisco la lavorazione di ribasso o gola
local sName = EgtIf( bEnablePreMill ~= nil, 'SideMill_', 'Mill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = WM.AddMachining( Proc, sName, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
end
if bUpwardMilling then
dStep = -dStep
end
EgtSetMachiningParam( MCH_MP.STEP, dStep)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 3) .. ';')
-- setto il lato di lavoro standard
EgtSetMachiningParam( MCH_MP.INVERT, true)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- modifico ingressi e uscita
-- se ho inserito il pretaglio modifico
if bEnablePreMill or bAsEnablePreMill then
if nModifyLeadInOut > 0 then
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
if dElev > ( 0.5 * dMillDiam) then
if nModifyLeadInOut == 1 then
-- setto il tipo di passo a una via
EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ONEWAY)
-- modifico il tipo di uscita
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG)
EgtSetInfo( nMchFId, 'Part', Proc.PartId)
-- se ho abilitato la lavorazione di lama per garantire passaggio utensile, setto la nota per spostare la fresatura dopo i tagli di lama
if bEnablePreMill or bAsEnablePreMill then
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nFacet}})
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_NEAR
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- imposto modo di lavorare la faccia
local nFaceUse = WL.GetNearestParalOpposite( Z_AX())
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto elevazione e step
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
dStepOri = dStep
if dStep < GEO.EPS_SMALL then dStep = 0.75 * dMaxMat end
local nStep = ceil( ( dThick - dMaxMat) / dStep)
dStep = max( ( dThick - dMaxMat) / max( nStep, 1), 0)
local dMaxElev = max( ( nStep + 1) * dStep - GEO.EPS_SMALL, 0)
if nSinglePass and nSinglePass > 0 then
dStep = 0
if nSinglePass == 1 then
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat)
end
end
if bUpwardMilling then
dStep = -dStep
end
EgtSetMachiningParam( MCH_MP.STEP, dStep)
-- leggo eventuali note esistenti della lavorazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
-- aggiungo alle note massima elevazione
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 3))
-- scrivo le note della lavorazione
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- setto il lato di lavoro standard
EgtSetMachiningParam( MCH_MP.INVERT, true)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- setto offset radiale per gestire le eventuali passate in orizzontale
local dRadialOffset = dSideStep * ( nSideStep - i)
EgtSetMachiningParam( MCH_MP.OFFSR, dRadialOffset)
-- modifico ingressi e uscita
-- se ho inserito il pretaglio modifico
if bEnablePreMill or bAsEnablePreMill then
if nModifyLeadInOut > 0 then
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
if dElev > ( 0.5 * dMillDiam) then
if nModifyLeadInOut == 1 then
-- setto il tipo di passo a una via
EgtSetMachiningParam( MCH_MP.STEPTYPE, MCH_MILL_ST.ONEWAY)
-- modifico il tipo di uscita
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG)
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
-- modifico dati supplementari uscita
EgtSetMachiningParam( MCH_MP.LOPERP, 0.5)
EgtSetMachiningParam( MCH_MP.LOTANG, -( dLongGorge + dExtraLongIni + dExtraLongEnd))
else
EgtSetMachiningParam( MCH_MP.LIPERP, dElev)
EgtSetMachiningParam( MCH_MP.LOPERP, dElev)
end
end
-- setto allungamenti iniziali e finali
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
if bInvertMach then
-- setto il lato di lavoro invertito
EgtSetMachiningParam( MCH_MP.INVERT, false)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
else
-- setto allungamenti iniziali e finali
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
if dElev > ( 0.5 * dMillDiam) then
-- setto allungamenti perpendicolari
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
-- modifico dati supplementari uscita
EgtSetMachiningParam( MCH_MP.LOPERP, 0.5)
EgtSetMachiningParam( MCH_MP.LOTANG, -( dLongGorge + dExtraLongIni + dExtraLongEnd))
else
EgtSetMachiningParam( MCH_MP.LIPERP, dElev)
EgtSetMachiningParam( MCH_MP.LOPERP, dElev)
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
end
end
-- se richiesto, setto la nota per spostare la lavorazione alla fine
if not WD.SIDEMILL_BEFORE then
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
end
else
if nModifyLeadInOut > 0 then
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
if dElev > ( 0.5 * dMillDiam) then
-- setto il tipo di passo a una via
EgtSetMachiningParam( MCH_MP.STEPTYPE, 1)
end
if bInvertMach then
-- setto il lato di lavoro invertito
EgtSetMachiningParam( MCH_MP.INVERT, false)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
end
-- setto allungamenti iniziali e finali
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
if bInvertMach then
-- setto il lato di lavoro invertito
EgtSetMachiningParam( MCH_MP.INVERT, false)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- se ho passate orizzontali riduco l'eventuale allungamento settato dall'utente
local dLiPerp = EgtGetMachiningParam( MCH_MP.LIPERP)
local dLoPerp = EgtGetMachiningParam( MCH_MP.LOPERP)
if dLiPerp > 0 then
dLiPerp = dLiPerp - dRadialOffset
end
else
-- setto allungamenti iniziali e finali
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
if dElev > ( 0.5 * dMillDiam) then
-- setto allungamenti perpendicolari
EgtSetMachiningParam( MCH_MP.LIPERP, 0)
EgtSetMachiningParam( MCH_MP.LOPERP, 0)
if dLoPerp > 0 then
dLoPerp = dLoPerp - dRadialOffset
end
EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp)
EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp)
-- se richiesto, setto la nota per spostare la lavorazione alla fine
if not WD.SIDEMILL_BEFORE then
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
end
end
-- se richiesto, setto la nota per spostare la lavorazione alla fine
if not WD.SIDEMILL_BEFORE then
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
end
else
if nModifyLeadInOut > 0 then
-- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita
if dElev > ( 0.5 * dMillDiam) then
-- setto il tipo di passo a una via
EgtSetMachiningParam( MCH_MP.STEPTYPE, 1)
end
if bInvertMach then
-- setto il lato di lavoro invertito
EgtSetMachiningParam( MCH_MP.INVERT, false)
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
end
-- setto allungamenti iniziali e finali
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd)
-- se richiesto, setto la nota per spostare la lavorazione alla fine
if not WD.SIDEMILL_BEFORE then
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
end
end
-- eseguo
if not EgtApplyMachining( true, false) then
-- provo a invertire posizione braccio porta testa
nSCC = MCH_SCC.ADIR_FAR
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
-- provo a invertire posizione braccio porta testa
nSCC = MCH_SCC.ADIR_FAR
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
end
else
@@ -1999,7 +2052,12 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
dStepOtherFace = -dStepOtherFace
end
EgtSetMachiningParam( MCH_MP.STEP, dStepOtherFace)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 3) .. ';')
-- leggo eventuali note esistenti della lavorazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
-- aggiungo alle note massima elevazione
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dMaxElev, 3))
-- scrivo le note della lavorazione
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
if bMachFromDn then
EgtSetMachiningParam( MCH_MP.INVERT, true)
EgtSetMachiningParam( MCH_MP.DEPTH, dDepthOtherFace)
@@ -2184,8 +2242,12 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
EgtOutLog( sWarn)
end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- leggo eventuali note della lavorazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
-- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( min( dElev, dMaxDepth), 1) .. ';')
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( min( dElev, dMaxDepth), 1))
-- scrivo le note della lavorazione
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
@@ -2225,7 +2287,7 @@ local function MakeOneFace( Proc, nRawId, b3Raw)
-- recupero la lavorazione di taglio con lama e i suoi parametri
local sCutting, dSawDiam, dSawThick, dSawMaxDepth = WM.FindCutting( 'Standard')
-- se non inclinata o capacità di taglio non sufficiente, provo con svuotatura
if not sCutting or vtN:getZ() > 0.866 or dSawMaxDepth < dDimV + WD.CUT_SIC then
if not sCutting or vtN:getZ() > 0.866 or dSawMaxDepth < dDimV + WD.CUT_EXTRA then
-- faccio con svuotatura
local nFacet = 0
return MakeByPocketing( Proc, nFacet, nRawId, b3Raw)
@@ -2605,8 +2667,12 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, EgtIf( dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, nil, nil, bLikeAsMakeFirstGroove, nSinglePass)
end
else
-- fresatura (se definita)
local sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV))
-- fresatura (se definita); se disponibile, cerco di usare un utensile che non lavori al limite della capacità di sottosquadro
local sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, 1.2 * dSideElev)
-- se non ho trovato un utensile un po' più grande del sottosquadro richiesto, passo alla ricerca standard
if not sMilling then
sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, dSideElev)
end
-- recupero i dati dell'utensile
local dMaxMat = 1000
local dMaxDepthOnSide = 0
@@ -2614,7 +2680,7 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
if sMilling and EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
local dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
local dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0
bIsBlade = EgtTdbGetCurrToolParam( MCH_TP.TYPE) & MCH_TF.SAWBLADE ~= 0
if bIsBlade then
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dMaxMat
@@ -2629,12 +2695,12 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw)
end
end
end
if sMilling and dElev < dMaxDepthOnSide then
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, sMilling)
-- altrimenti sega a catena
else
return MakeByChainSaw( Proc, nFacInd, nRawId, b3Raw, dElev, dH, dV)
end
if sMilling and dElev < dMaxDepthOnSide then
return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, sMilling)
-- altrimenti sega a catena
else
return MakeByChainSaw( Proc, nFacInd, nRawId, b3Raw, dElev, dH, dV)
end
end
end
local nFacet = EgtIf( bPckt or vtN:getZ() >= WD.NZ_MINA, nFacInd, nFacInd2)
+5 -4
View File
@@ -1,8 +1,9 @@
-- WallExec.lua by Egaltech s.r.l. 2023/06/27
-- WallExec.lua by Egaltech s.r.l. 2023/07/04
-- Libreria esecuzione lavorazioni per Pareti
-- 2023/05/25 Aggiunto ordinamento in base a priorità da btl.
-- 2023/06/07 Nel caso di outline con priorità aggiunta la rimozione degli sfridi nella lavorazione successiva.
-- 2023/06/27 Aggiunte origini TN e BN.
-- 2023/07/04 Se c'è funzione di macchina WD.GetOrigCorner si lascia scegliere posizione default a questa impostando 0 se non c'è 'REFPOS'.
-- Tabella per definizione modulo
local WallExec = {}
@@ -74,7 +75,7 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr
local nCorner
local sOrigCorner = WD.ORIG_CORNER or 'BR'
if WD.GetOrigCorner then
sOrigCorner = WD.GetOrigCorner( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'REFPOS', 'i') or 1)
sOrigCorner = WD.GetOrigCorner( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'REFPOS', 'i') or 0)
end
if sOrigCorner == 'TL' then
nCorner = MCH_CR.TL
@@ -104,7 +105,7 @@ function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewPr
-- Impostazione dell'attrezzaggio di default
EgtImportSetup()
-- Impostazione eventuale allargamento area disponibile per grezzo
EgtSetTableAreaOffset( WD.TAB_EXTRA_XP or 0, WD.TAB_EXTRA_XM or 0, WD.TAB_EXTRA_YP or 0, WD.TAB_EXTRA_YM or 0)
EgtSetTableAreaOffset( WD.TAB_EXTRA_XP or 0, WD.TAB_EXTRA_YP or 0, WD.TAB_EXTRA_XM or 0, WD.TAB_EXTRA_YM or 0)
-- Creazione del grezzo e suo posizionamento in macchina
local nRaw = GDB_ID.NULL
if nRawOutlineId and nRawOutlineId ~= GDB_ID.NULL then
@@ -611,7 +612,7 @@ function InsertScrapRemoval( nPhase)
end
nCurrentOperationId = EgtGetNextOperation( nCurrentOperationId)
end
EgtSetCurrMachining( nActiveMachiningId)
EgtSetCurrMachining( nActiveMachiningId or GDB_ID.NULL)
end
-------------------------------------------------------------------------------------------------------------
+31
View File
@@ -1,5 +1,36 @@
==== Wall Update Log ====
Versione 2.5i3 (21/09/2023)
- Modif : per pulizia corner di FreeContour disabilitato metodo con tunnel ed esteso metodo con tre punti
- Modif : in LapJoint aggiornata pulizia corner come FreeContour
- Fixed : in FreeContour e Lapjoint, in MakeByMill, modificato SCC per correggere caso con lama su testa fresa.
Versione 2.5i2 (20/09/2023)
- Modif : in LapJoint con una sola faccia controllo lavorabilità ora come per FreeContour
- Modif : in CleanCorner ora AuxDir (SCC) sempre Z+
- Fixed : in FreeContour piccola correzione alla pulizia corner
- Fixed : corretta impostazione allargamento aree disposizone grezzi su tavola.
Versione 2.5i1 (12/09/2023)
- Fixed : correzioni per pulizia corner in FreeContour.
Versione 2.5h1 (01/08/2023)
- Modif : in sideGroove migliorato il controllo che la testa non scenda sotto al livello del grezzo (ora considera anche il diametro minimo della testa e non interviene se la lavorazione è spostata a dopo il taglio outline).
- Fixed : corretto bug in MachiningLib -> AddMachining che contempla il caso in cui Proc non sia una tabella
Versione 2.5g3 (26/07/2023)
- Modif : Nei tagli di lama angolo Z minimo ora gestito tramite costante da WallData CUT_VZ_MIN (default -0.5)
- Modif : Nelle fresature di ripresa angoli dei contorni migliorata la scelta della fresa secondaria in caso non sia disponibile una fresa di lunghezza sufficiente.
Versione 2.5g2 (25/07/2023)
- Added : aggiunte passate laterali per SideGroove, se specificato SIDESTEP nelle note utensile.
Versione 2.5g1 (04/07/2023)
- Modif : per posizione default del grezzo ora si assegna 0 per lasciare il compito a WD.GetOrigCorner di macchina.
Versione 2.5f3 (30/06/2023)
- Modif : in LapJoint aggiunta lettura di eventuali note di lavorazione esistenti.
Versione 2.5f2 (28/06/2023)
- Added : aggiunte due nuove origini (TN e BN che come X usano WD.NEW_REF), in totale ora sono 8.
+2 -2
View File
@@ -1,6 +1,6 @@
-- Version.lua by Egalware s.r.l. 2023/06/28
-- Version.lua by Egalware s.r.l. 2023/09/18
-- Gestione della versione di Wall
NAME = 'Wall'
VERSION = '2.5f2'
VERSION = '2.5i3'
MIN_EXE = '2.5b3'