Compare commits

...

34 Commits

Author SHA1 Message Date
luca.mazzoleni 10bfb3273c Merge branch 'release/2.5j3' 2023-10-23 13:18:21 +02:00
luca.mazzoleni 1ef5ae8f0c update log 2023-10-23 13:18:07 +02:00
luca.mazzoleni 12bb64bacb Merge remote-tracking branch 'origin/master' into develop 2023-10-19 09:13:47 +02:00
Dario Sassi 35fa519eb3 DataWall 2.5j3 :
- nella ricerca lavorazione da usare controllo di utensile attivo sostituito con controllo utensile presente nel setup corrente
- aggiunta gestione aree vietate per chiodature (LockOut for Nail).
2023-10-18 11:19:37 +02:00
luca.mazzoleni fdd6b7f7bb Merge remote-tracking branch 'origin/master' into develop 2023-10-16 10:07:03 +02:00
Dario Sassi 7c2bc2ec5d DataWall 2.5j2 :
- in FreeContour conversione automatica di facce non fattibili con lama per limiti di orientamento in facce da fare con fresa.
2023-10-12 10:53:11 +02:00
luca.mazzoleni f6286d839a Merge remote-tracking branch 'origin/master' into develop 2023-10-02 14:41:20 +02:00
Dario Sassi 33deb8b5e3 DataWall 2.5l1 :
- in FreeContour correzione a MakeCustomPath per calcolare correttamente puliture spigoli di tipo 2 (Clean 30) e 3 (Gola di Scarico)
- in LapJoint aggiunta segnalazione lavorazione tipo Side non trovata.
2023-10-02 13:24:03 +02:00
luca.mazzoleni 736065eaad Merge branch 'master' into develop 2023-09-28 09:17:08 +02:00
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 fa9a8a7e49 Merge tag '2.5i1' into develop
Finish Release: 2.5i1
2023-09-19 10:25:12 +02:00
8 changed files with 311 additions and 207 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
+4 -3
View File
@@ -1,9 +1,10 @@
-- MachiningLib.lua by Egaltech s.r.l. 2022/01/12
-- MachiningLib.lua by Egaltech s.r.l. 2023/10/18
-- Libreria ricerca lavorazioni per Pareti
-- 2023/03/09 Piccola correzione alla SideDepth in FindMilling
-- In FindMilling aggiunta gestione spessore e massimo materiale nel caso di lam
-- 2023/05/25 Aggiunta funzione AddMachining che incapsula EgtAddMachining trascrivendo le priorità btl dalle feature alle lavorazioni.
-- 2023/06/07 Alla funzione AddMachining aggiunta la scrittura dell'info ISOUTLINE alle lavorazioni.
-- 2023/10/18 In SetCurrMachiningAndTool sostituito controllo di utensile attivo con controllo utensile nel setup corrente.
-- Tabella per definizione modulo
local WMachiningLib = {}
@@ -32,7 +33,7 @@ local function SetCurrMachiningAndTool( sMachName)
local sTool = EgtTdbGetToolFromUUID( sTuuid)
if not sTool then return false end
if not EgtTdbSetCurrTool( sTool) then return false end
return EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
return EgtFindToolInCurrSetup( sTool)
end
---------------------------------------------------------------------
@@ -186,7 +187,7 @@ end
---------------------------------------------------------------------
function WMachiningLib.AddMachining( Proc, sName, sMachining)
local nMchId, sFinalName = EgtAddMachining( sName, sMachining)
if type(Proc) == 'table' then
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)
+176 -131
View File
@@ -1,4 +1,4 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2023/09/12
-- ProcessFreeContour.lua by Egaltech s.r.l. 2023/10/02
-- 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.
@@ -22,6 +22,9 @@
-- 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.
-- 2023/10/02 Correzione a MakeCustomPath per calcolare correttamente puliture spigoli di tipo 2 (Clean 30) e 3 (Gola di Scarico).
-- Tabella per definizione modulo
local WPF = {}
@@ -61,6 +64,8 @@ end
---------------------------------------------------------------------
-- Classificazione della feature
function WPF.Classify( Proc, b3Raw)
-- se area vietata (LockOut) non faccio nulla
if Proc.LockOut then return true end
-- verifico se di tipo pocket
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
-- recupero la curva associata
@@ -545,7 +550,7 @@ local function GetFacesData( Proc, bOpposite, bCalclForBlade, dToolDiam, dToolMa
end
---------------------------------------------------------------------
local function GetTunnelDimension( nId, nPartId, nAddGrpId)
local function GetTunnelDimension( nId, nPartId, nAddGrpId, bClosed)
-- sono necessarie almeno 2 facce
local nFacCnt = EgtSurfTmFacetCount( nId)
if nFacCnt < 2 then return end
@@ -559,7 +564,7 @@ local function GetTunnelDimension( nId, nPartId, nAddGrpId)
end
-- determino l'asse medio (le facce sono già ordinate consecutivamente)
local vtAx = V_NULL()
for i = 1, nFacCnt do
for i = 1, EgtIf( bClosed, nFacCnt, nFacCnt - 1) do
local j = i % nFacCnt + 1
local vtOrtho = vtN[i] ^ vtN[j]
if vtOrtho:normalize() then
@@ -627,45 +632,52 @@ end
---------------------------------------------------------------------
local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick, bClosed)
-- creo il percorso di lavorazione come contorni inferiori delle facce
local nPath = {}
local nPathData = {}
for i = 1, #vGeom do
local dAng
-- ottengo curva inferiore 1
local ptP1, ptP2, ptP3, vtV1, vtV2, dDim1, dDim2 = EgtSurfTmFacetOppositeSide( vGeom[i][1], vGeom[i][2], Z_AX() , GDB_ID.ROOT)
if i < #vGeom then
-- ricavo i punti e l'angolo interno
_, _, _, dAng = EgtSurfTmFacetsContact( vGeom[i][1], vGeom[i][2], vGeom[i+1][2], GDB_ID.ROOT)
elseif bClosed then
-- ricavo i punti e l'angolo interno
_, _, _, dAng = EgtSurfTmFacetsContact( vGeom[i][1], vGeom[i][2], vGeom[1][2], GDB_ID.ROOT)
else
dAng = 0
end
local ptP1, _, ptP3 = EgtSurfTmFacetOppositeSide( vGeom[i][1], vGeom[i][2], Z_AX() , GDB_ID.ROOT)
-- creo linea
local nId1 = EgtLine( nAddGrpId, ptP1, ptP3, GDB_RT.GLOB)
table.insert( nPath, nId1)
table.insert( nPathData, {nId1, dAng})
end
-- creo il percorso e poi lo offsetto del raggio utensile
local AuxId = EgtCurveCompo( nAddGrpId, nPath, true)
EgtOffsetCurve( AuxId, dMillDiam / 2, GDB_OT.EXTEND)
-- offsetto a destra il percorso del raggio utensile
EgtOffsetCurve( AuxId, dMillDiam / 2, GDB_OT.FILLET)
-- spezzo il percorso nelle entità componenti
local nId1st, nIdCount = EgtExplodeCurveCompo( AuxId)
-- se il numero entità è diverso da quelle iniziali esco con errore
if nIdCount ~= #vGeom then
if not nId1st then
local sErr = 'Error : cannot make offset path'
return 0, sErr
end
-- calcolo angoli tra le entità consecutive
local nPathData = {}
local nIdLast = nId1st + nIdCount - 1
for i = nId1st, nIdLast do
if i < nIdLast or bClosed then
local j = EgtIf( i < nIdLast, i + 1, nId1st)
local vtDirFin = EgtEV( i, GDB_ID.ROOT)
local vtDirSta = EgtSV( j, GDB_ID.ROOT)
local dAng = GetAngleXY( vtDirFin, vtDirSta)
local vtBisett = -vtDirFin + vtDirSta
if not vtBisett:normalize() then
vtBisett = VectorFromRotated( vtDirFin, Z_AX(), -90)
end
table.insert( nPathData, { i, dAng, vtBisett})
end
end
-- resetto la tabella
nPath = {}
AuxId = nil
-- 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
@@ -688,17 +700,14 @@ local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick, bC
table.insert( nPath, ( nId1st + i - 1))
-- se non è la linea finale e l'angolo tra le due facce è ammesso
if ( i < nIdCount or bClosed) and dThick <= ( WD.MAX_CLEAN_CRN30 + 20 * GEO.EPS_SMALL) and
nPathData[i][2] < 0 and nPathData[i][2] > -( 180 - dAngleSmall + 10 * GEO.EPS_SMALL) then
nPathData[i][2] < -5 and nPathData[i][2] > -( 180 - dAngleSmall + 10 * GEO.EPS_SMALL) then
-- aggiungo una retta sulla bisettrice
local _, vtN2 = EgtSurfTmFacetCenter( vGeom[i][1], vGeom[i][2], GDB_ID.ROOT)
local _, vtN3 = EgtSurfTmFacetCenter( vGeom[i][1], vGeom[EgtIf( i == nIdCount, 1, i+1)][2], GDB_ID.ROOT)
local ptP1 = EgtEP( ( nId1st + i - 1), GDB_ID.ROOT)
-- sommo i tre versori per avere una direzione media
local vtExtrExit = vtN2 + vtN3
local vtExtrExit = nPathData[i][3]
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)
@@ -716,18 +725,15 @@ local function MakeCustomPath( vGeom, nConeCut, dMillDiam, nAddGrpId, dThick, bC
-- se non è la linea finale e l'angolo tra le due facce è ammesso
if ( i < nIdCount or bClosed) and nPathData[i][2] < 0 then
-- aggiungo una retta sulla bisettrice
local _, vtN2 = EgtSurfTmFacetCenter( vGeom[i][1], vGeom[i][2], GDB_ID.ROOT)
local _, vtN3 = EgtSurfTmFacetCenter( vGeom[i][1], vGeom[EgtIf( i == nIdCount, 1, i+1)][2], GDB_ID.ROOT)
local ptP1 = EgtEP( ( nId1st + i - 1), GDB_ID.ROOT)
-- sommo i tre versori per avere una direzione media
local vtExtrExit = vtN2 + vtN3
local vtExtrExit = nPathData[i][3]
vtExtrExit:normalize()
vtExtrExit = -vtExtrExit
-- calcolo di quanto entrare
local dLenAdd = abs( (dMillDiam/2) / cos( nPathData[i][2]/2)) + dExtraCorner - (dMillDiam/2)
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)
@@ -814,7 +820,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, ''
@@ -1003,10 +1009,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)
@@ -1082,6 +1085,8 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
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
@@ -1092,9 +1097,10 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
local nFacCnt = EgtSurfTmFacetCount( nNewProc)
local nFacInd, dDepth, nSurfInt
local bMakeLocSurf
if nFacCnt <= 4 then
-- RIMUOVERE
if false and nFacCnt <= 4 then
-- recupero profondità e faccia di fondo
_, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId)
_, _, dDepth, _, _, nSurfInt = GetTunnelDimension( nNewProc, Proc.PartId, nAddGrpId, bClosed)
if nSurfInt then
-- aggiungo la faccia di fondo appena calcolata
nNewProc = EgtSurfTmBySewing( nAddGrpId, { nNewProc, nSurfInt}, true)
@@ -1106,11 +1112,10 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
else
return true
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)
@@ -1125,27 +1130,27 @@ 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 (nface1, nFace2, tFacAdj)
-- variabili costruzione geometria (nFace1, nFace2, tFacAdj)
local nFace1 = vFace[i].Fac
-- 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
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
@@ -1183,9 +1188,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
@@ -1210,26 +1215,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
@@ -1254,7 +1261,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
dMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), dFreeLen) or dMaxDepth
end
end
-- verifico se la facce hanno alcuni lati molto corti e possono quindi essere approssimate a 3 lati
-- verifico se le facce hanno alcuni lati molto corti e possono quindi essere approssimate a 3 lati
for currentFace = 1, #vFace do
if Is3EdgesApprox( Proc, vFace[currentFace].Fac, nAddGrpId) then
vFace[currentFace].Is3EdgesApprox = true
@@ -1860,7 +1867,8 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_NEAR)
end
-- eseguo
if not EgtApplyMachining( true, false) then
local bApplyOk = EgtApplyMachining( true, false)
if not bApplyOk then
-- provo a invertire direzione, lato di lavoro e attacco/uscita
EgtSetMachiningParam( MCH_MP.INVERT, not bInvert)
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( not bInvert, MCH_SAW_WS.LEFT, MCH_SAW_WS.RIGHT))
@@ -1869,14 +1877,22 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, EgtIf( nLeadIn == MCH_SAW_LI.STRICT, MCH_SAW_LO.STRICT, MCH_SAW_LO.CENT))
EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal)
-- ri-eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
bApplyOk = EgtApplyMachining( true, false)
if not bApplyOk then
local nErr, sErr = EgtGetLastMachMgrError()
-- se direzione irraggiungibile (solitamente lama su testa fresa 5A e taglio inclinato) si imposta di usare fresa
if nErr == 2215 then
EgtOutLog( ' Warning : sawing impossible due to unreachable direction, try milling')
EgtRemoveOperation( nMchId)
vFace[i].Type = 4
else
EgtSetOperationMode( nMchId, false)
return false, sErr
end
end
end
-- se limite lunghezza di taglio e taglio lo supera
if WD.CUT_MAX_LENGTH and vFace[i].Len > WD.CUT_MAX_LENGTH then
if bApplyOk and WD.CUT_MAX_LENGTH and vFace[i].Len > WD.CUT_MAX_LENGTH then
-- sdoppio la lavorazione
local sSouName = EgtGetName( nMchId)
local nNewMchId = EgtCopyMachining( sSouName..'_B', sSouName)
@@ -2191,7 +2207,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
@@ -2292,7 +2308,7 @@ local function MakeByMark( Proc, nRawId, b3Raw)
end
---------------------------------------------------------------------
local function MakeByNail( Proc, nRawId, b3Raw)
local function MakeByNail( Proc, nRawId, b3Raw, vNLO)
-- ingombro del pezzo
local Ls = EgtGetFirstNameInGroup( Proc.PartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
@@ -2319,6 +2335,36 @@ local function MakeByNail( Proc, nRawId, b3Raw)
nCntData = nCntData + 10
end
local dCntPar = EgtGetInfo( Proc.Id, 'CNT_PAR', 'd') or 100
-- se presenti aree vietate alle chiodature, gestisco le geometrie
local vCrvs = {}
if #vNLO > 0 then
-- in presenza di aree vietate non sono ammesse lavorazioni in doppio (non dovrebbe mai accadere per precedenti controlli)
if Proc.Double then
local sErr = 'Error : nailing in double with LockOut Area not allowed'
EgtOutLog( sErr)
return false, sErr
end
-- gruppo ausiliario
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
-- copio la curva da lavorare
vCrvs[1] = EgtCopyGlob( AuxId, nAddGrpId)
-- la trimmo con tutte le aree vietate
for i = 1, #vNLO do
local vRes = {}
for j = 1, #vCrvs do
local nNewId, nCount = EgtTrimCurveWithRegion( vCrvs[j], vNLO[i], false, false)
if nNewId then
vRes = EgtTableAdd( vRes, nNewId, nCount)
end
end
vCrvs = vRes
end
else
vCrvs[1] = AuxId
end
-- per debug
local sOut = table.concat( vCrvs, ',')
EgtOutLog( 'Nailing curve : '.. ( sOut or ''))
-- recupero la lavorazione
local sNailing = WM.FindNailing( nCntData)
if not sNailing then
@@ -2326,49 +2372,51 @@ local function MakeByNail( Proc, nRawId, b3Raw)
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione
local sName = 'Nail_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = WM.AddMachining( Proc, sName, sNailing)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sNailing
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchId, 'Part', Proc.PartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- percorso da non invertire
EgtSetMachiningParam( MCH_MP.INVERT, false)
-- se estrusione da sotto, inverto direzione fresa
if bToolInv then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
-- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, 10)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER)
-- se in doppio lungo Y, devo dimezzare opportunamente la lavorazione
local dExtraDelta = 0
if Proc.Double == 2 then
dExtraDelta = 0.45 * dCntPar
if Proc.Delta > 0 then
EgtSetMachiningParam( MCH_MP.ENDADDLEN, -Proc.DblAcc - dExtraDelta)
else
EgtSetMachiningParam( MCH_MP.STARTADDLEN, -Proc.DblAcc - dExtraDelta)
for i = 1, #vCrvs do
-- inserisco la lavorazione
local sName = 'Nail_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_'..tostring( i)
local nMchId = WM.AddMachining( Proc, sName, sNailing)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sNailing
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchId, 'Part', Proc.PartId)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ vCrvs[i], -1}})
-- percorso da non invertire
EgtSetMachiningParam( MCH_MP.INVERT, false)
-- se estrusione da sotto, inverto direzione fresa
if bToolInv then
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end
-- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, 10)
-- assegno lato di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER)
-- se in doppio lungo Y, devo dimezzare opportunamente la lavorazione
local dExtraDelta = 0
if Proc.Double == 2 then
dExtraDelta = 0.45 * dCntPar
if Proc.Delta > 0 then
EgtSetMachiningParam( MCH_MP.ENDADDLEN, -Proc.DblAcc - dExtraDelta)
else
EgtSetMachiningParam( MCH_MP.STARTADDLEN, -Proc.DblAcc - dExtraDelta)
end
end
-- assegno parametri a note utente
local sUserNotes = 'Par=' .. EgtNumToString( dCntPar, 0) .. ';'
if Proc.Double and Proc.Double > 0 then
sUserNotes = sUserNotes .. 'Dbl=' .. EgtNumToString( Proc.Double, 0) .. ';' ..
'Dlt=' .. EgtNumToString( abs( Proc.Delta) + dExtraDelta, 0) .. ';'
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
end
-- assegno parametri a note utente
local sUserNotes = 'Par=' .. EgtNumToString( dCntPar, 0) .. ';'
if Proc.Double and Proc.Double > 0 then
sUserNotes = sUserNotes .. 'Dbl=' .. EgtNumToString( Proc.Double, 0) .. ';' ..
'Dlt=' .. EgtNumToString( abs( Proc.Delta) + dExtraDelta, 0) .. ';'
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
end
return true
end
@@ -2412,7 +2460,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
@@ -2555,7 +2603,7 @@ end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPF.Make( Proc, nRawId, b3Raw)
function WPF.Make( Proc, nRawId, b3Raw, vNLO)
-- recupero la tipologia (contorno o tasca)
local bPocket = ( EgtGetInfo( Proc.Id, 'PCKT', 'i') == 1)
-- se svuotatura
@@ -2575,10 +2623,7 @@ function WPF.Make( Proc, nRawId, b3Raw)
return MakeByMark( Proc, nRawId, b3Raw)
-- se chiodatura
elseif nCntType == 20 then
return MakeByNail( Proc, nRawId, b3Raw)
-- area vietata
elseif nCntType == 200 then
return true, 'Lock-out area Ignored'
return MakeByNail( Proc, nRawId, b3Raw, vNLO)
-- altrimenti, taglio con lama e pulizia angoli con fresa
else
return MakeByCut( Proc, nRawId, b3Raw)
+64 -58
View File
@@ -1,4 +1,4 @@
-- WProcessLapJoint.lua by Egaltech s.r.l. 2023/04/17
-- WProcessLapJoint.lua by Egaltech s.r.l. 2023/10/02
-- 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.
@@ -26,6 +26,10 @@
-- 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.
-- 2023/10/02 Aggiunta segnalazione lavorazione tipo Side non trovata.
-- Tabella per definizione modulo
local WPL = {}
@@ -113,8 +117,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
@@ -122,7 +126,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)
@@ -191,8 +195,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)
@@ -807,7 +811,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
@@ -828,11 +832,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)
@@ -840,16 +844,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
@@ -878,44 +882,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
@@ -925,7 +929,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
@@ -934,36 +938,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
@@ -986,7 +990,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))
@@ -1004,10 +1008,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)
@@ -1096,7 +1097,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
@@ -1113,6 +1115,7 @@ local function AddMillCorner( nTypeConeCut, vFace, Proc, nRawId, b3Raw,
EgtOutLog( sErr)
return false, sErr
end
-- FINE PARTE DA RIMUOVERE
else
bMakeLocSurf = true
end
@@ -1132,38 +1135,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
@@ -1191,9 +1193,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
@@ -1344,7 +1346,11 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist)
local _, vtRef = EgtSurfTmFacetCenter( Proc.Id, nOthFac, GDB_ID.ROOT)
-- recupero la lavorazione
local sMilling = WM.FindMilling( 'Side')
if not sMilling then return false end
if not sMilling then
local sErr = 'Error : Side not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dMillDiam = 20
local dMillLen = 10
@@ -1401,7 +1407,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
@@ -2286,7 +2292,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)
+24 -11
View File
@@ -1,9 +1,10 @@
-- WallExec.lua by Egaltech s.r.l. 2023/07/04
-- WallExec.lua by Egaltech s.r.l. 2023/10/16
-- 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'.
-- 2023/10/16 Aggiunta gestione Aree vietate (LockOut) per chiodature.
-- Tabella per definizione modulo
local WallExec = {}
@@ -105,7 +106,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
@@ -216,6 +217,16 @@ function WallExec.CollectFeatures( PartId, b3Raw)
Proc2.TaskId = Proc.TaskId
table.insert( vProc, Proc2)
end
-- se free contour
elseif FreeContour.Identify( Proc) then
-- recupero il tipo e il dato della lavorazione
local nCntType = EgtGetInfo( Proc.Id, 'CNT_TYPE', 'i') or 0
local nCntData = EgtGetInfo( Proc.Id, 'CNT_DATA', 'i') or 0
-- imposto se area vietata
if nCntType == 200 then
Proc.LockOut = EgtIf( ( nCntData == 0 or ( nCntData & 1) ~= 0), 1, -1)
end
if Proc.LockOut then Proc.Flg = 0 end
end
else
EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)')
@@ -285,15 +296,15 @@ local function PrintFeatures( vProc)
EgtOutLog( ' *** Feature List ***')
for i = 1, #vProc do
local Proc = vProc[i]
local sOut = string.format( 'Part=%3d Proc=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Fcse=%1d,%1d Diam=%.2f Fct=%2d Dbl=%2d Dlt=%.1f Box=%s',
local sOut = string.format( 'Part=%3d Proc=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Lo=%d Fcse=%1d,%1d Diam=%.2f Fct=%2d Dbl=%2d Dlt=%.1f Box=%s',
Proc.PartId, Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId,
Proc.Flg, Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, Proc.Double or 0, Proc.Delta or 0, tostring( Proc.Box))
Proc.Flg, EgtIf( Proc.LockOut, 1, 0), Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, Proc.Double or 0, Proc.Delta or 0, tostring( Proc.Box))
EgtOutLog( sOut)
end
end
-------------------------------------------------------------------------------------------------------------
local function AddFeatureMachining( Proc, nRawId, b3Raw)
local function AddFeatureMachining( Proc, nRawId, b3Raw, vNLO)
local bOk = true
local sErr = ''
EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1)
@@ -335,8 +346,8 @@ local function AddFeatureMachining( Proc, nRawId, b3Raw)
bOk, sErr = Text.Make( Proc, nRawId, b3Raw)
-- se contorno libero, outline o apertura ( 0/3/4-250/251/252-X)
elseif FreeContour.Identify( Proc) then
-- esecuzione contorno
bOk, sErr = FreeContour.Make( Proc, nRawId, b3Raw)
-- esecuzione contorno libero
bOk, sErr = FreeContour.Make( Proc, nRawId, b3Raw, vNLO)
-- se feature custom (Variant)
elseif Variant.Identify( Proc) then
-- esecuzione
@@ -641,9 +652,11 @@ function WallExec.ProcessFeatures()
end
-- classifico le feature
ClassifyFeatures( vProc, b3Raw)
-- Eventuale determinazione delle feature lavorabili in parallelo (implementata nella configurazione macchina)
-- recupero l'elenco delle aree vietate alle chiodature
local vNLO = WL.GetNailLockOutAreas( vProc)
-- Se non ci sono aree vietate alle chiodature, eventuale determinazione delle feature lavorabili in parallelo (implementata nella configurazione macchina)
-- si impostano i flag Double (nil/0=no, 1=su X, 2=su Y) e Delta (offset tra T14 e T12 positivo o negativo)
if WD.FindFeaturesInDouble then
if #vNLO == 0 and WD.FindFeaturesInDouble then
WD.FindFeaturesInDouble( vProc, b3Raw)
end
-- debug
@@ -656,7 +669,7 @@ function WallExec.ProcessFeatures()
-- creo la lavorazione
local Proc = vProc[i]
if Proc.Flg ~= 0 then
local bOk, sMsg = AddFeatureMachining( Proc, nRawId, b3Raw)
local bOk, sMsg = AddFeatureMachining( Proc, nRawId, b3Raw, vNLO)
if not bOk then
nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
@@ -665,7 +678,7 @@ function WallExec.ProcessFeatures()
else
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
end
elseif not Proc.Double then
elseif not Proc.Double and not Proc.LockOut then
local sMsg = 'Feature not machinable by orientation'
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
end
+20 -1
View File
@@ -1,4 +1,4 @@
-- WallLib.lua by Egaltech s.r.l. 2022/04/04
-- WallLib.lua by Egaltech s.r.l. 2023/10/16
-- Libreria globale per Pareti
-- Tabella per definizione modulo
@@ -316,5 +316,24 @@ function WallLib.GetNearestOrthoOpposite( vtRef, vtNorm)
return nil
end
-------------------------------------------------------------------------------------------------------------
function WallLib.GetNailLockOutAreas( vProc)
local vNLO = {}
for i = 1, #vProc do
if vProc[i].LockOut == 1 then
local AuxId = EgtGetInfo( vProc[i].Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + vProc[i].Id end
if AuxId then
local nAddGrpId = WallLib.GetAddGroup( vProc[i].PartId)
local nSfrId = EgtSurfFlatRegion( nAddGrpId, {AuxId})
if nSfrId then
table.insert( vNLO, nSfrId)
end
end
end
end
return vNLO
end
-------------------------------------------------------------------------------------------------------------
return WallLib
+19
View File
@@ -1,5 +1,24 @@
==== Wall Update Log ====
Versione 2.5j3 (23/10/2023)
- Added : aggiunta gestione aree vietate per chiodature (LockOut for Nail)
- Modif : in FreeContour conversione automatica di facce non fattibili con lama per limiti di orientamento in facce da fare con fresa.
- Modif : in LapJoint aggiunta segnalazione lavorazione tipo Side non trovata.
- Modif : migliorata funzione Is3EdgesApprox in WallLib
- Modif : nella ricerca lavorazione da usare controllo di utensile attivo sostituito con controllo utensile presente nel setup corrente
- Fixed : in FreeContour correzione a MakeCustomPath per calcolare correttamente puliture spigoli di tipo 2 (Clean 30) e 3 (Gola di Scarico)
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.
+2 -2
View File
@@ -1,6 +1,6 @@
-- Version.lua by Egalware s.r.l. 2023/09/12
-- Version.lua by Egalware s.r.l. 2023/10/11
-- Gestione della versione di Wall
NAME = 'Wall'
VERSION = '2.5i1'
VERSION = '2.5j3'
MIN_EXE = '2.5b3'