|
|
|
@@ -1,7 +1,8 @@
|
|
|
|
|
-- ProcessFreeContour.lua by Egaltech s.r.l. 2021/12/10
|
|
|
|
|
-- ProcessFreeContour.lua by Egaltech s.r.l. 2022/01/12
|
|
|
|
|
-- 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.
|
|
|
|
|
-- 2022/01/12 Aggiunta gestione massimo affondamento in Z anche per pulizia spigoli con fresa 60deg (WD.MAX_CLEAN_CRN60).
|
|
|
|
|
|
|
|
|
|
-- Tabella per definizione modulo
|
|
|
|
|
local WPF = {}
|
|
|
|
@@ -15,6 +16,7 @@ EgtOutLog( ' WProcessFreeContour started', 1)
|
|
|
|
|
-- Dati
|
|
|
|
|
local WD = require( 'WallData')
|
|
|
|
|
local WM = require( 'WMachiningLib')
|
|
|
|
|
if not WD.MAX_CLEAN_CRN60 then WD.MAX_CLEAN_CRN60 = 150 end
|
|
|
|
|
local WHISK_OFFS = 0.1
|
|
|
|
|
local WHISK_SAFE = 5
|
|
|
|
|
local MIN_LEN_CUT = 250
|
|
|
|
@@ -1189,7 +1191,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
|
|
|
|
EgtSetInfo( nMchId, 'Part', Proc.PartId)
|
|
|
|
|
-- calcolo l'affondamento
|
|
|
|
|
local dDepth = vFace[i].Width + WD.CUT_EXTRA
|
|
|
|
|
dThick = dDepth
|
|
|
|
|
dThick = vFace[i].Width
|
|
|
|
|
local vtNz = vFace[i].Norm:getZ()
|
|
|
|
|
if vtNz < 0 then
|
|
|
|
|
dDepth = dDepth - dMillDiam * abs( vtNz) / sqrt( 1 - vtNz * vtNz)
|
|
|
|
@@ -1247,7 +1249,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
|
|
|
|
EgtSetInfo( nMchId, 'Part', Proc.PartId)
|
|
|
|
|
-- calcolo l'affondamento
|
|
|
|
|
local dDepth = vFace[i].Width + WD.CUT_EXTRA
|
|
|
|
|
dThick = dDepth
|
|
|
|
|
dThick = vFace[i].Width
|
|
|
|
|
local vtNz = vFace[i].Norm:getZ()
|
|
|
|
|
if vtNz < 0 then
|
|
|
|
|
dDepth = dDepth - dMillDiam * abs( vtNz) / sqrt( 1 - vtNz * vtNz)
|
|
|
|
@@ -1413,7 +1415,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
|
|
|
|
EgtSetInfo( nMchId, 'Part', Proc.PartId)
|
|
|
|
|
-- calcolo l'affondamento
|
|
|
|
|
local dDepth = vFace[i].Width + WD.CUT_EXTRA
|
|
|
|
|
dThick = dDepth
|
|
|
|
|
dThick = vFace[i].Width
|
|
|
|
|
local vtNz = vFace[i].Norm:getZ()
|
|
|
|
|
if vtNz < 0 then
|
|
|
|
|
dDepth = dDepth - dMillDiam * abs( vtNz) / sqrt( 1 - vtNz * vtNz)
|
|
|
|
@@ -1466,6 +1468,7 @@ end
|
|
|
|
|
local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
|
|
|
|
|
-- flag per tagli non passanti
|
|
|
|
|
local bNotThrou
|
|
|
|
|
local dThick
|
|
|
|
|
-- recupero i dati dell'utensile
|
|
|
|
|
local dSawDiam = 0
|
|
|
|
|
local dMaxDepth = 0
|
|
|
|
@@ -1498,7 +1501,8 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
|
|
|
|
|
EgtSetInfo( nMchId, 'Part', Proc.PartId)
|
|
|
|
|
-- calcolo l'affondamento
|
|
|
|
|
local dDepth = vFace[i].Width + WD.CUT_EXTRA
|
|
|
|
|
-- se affondamento superiore ai limiti della fresa
|
|
|
|
|
dThick = vFace[i].Width
|
|
|
|
|
-- se affondamento superiore ai limiti della sega a catena
|
|
|
|
|
if dDepth > dMaxDepth then
|
|
|
|
|
dDepth = dMaxDepth
|
|
|
|
|
bNotThrou = true
|
|
|
|
@@ -1546,7 +1550,8 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
|
|
|
|
|
EgtSetInfo( nMchId, 'Part', Proc.PartId)
|
|
|
|
|
-- calcolo l'affondamento
|
|
|
|
|
local dDepth = vFace[i].Width + WD.CUT_EXTRA
|
|
|
|
|
-- se affondamento superiore ai limiti della fresa
|
|
|
|
|
dThick = vFace[i].Width
|
|
|
|
|
-- se affondamento superiore ai limiti della sega a catena
|
|
|
|
|
if dDepth > dMaxDepth then
|
|
|
|
|
dDepth = dMaxDepth
|
|
|
|
|
bNotThrou = true
|
|
|
|
@@ -1587,9 +1592,9 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
-- se fresature non sono passanti
|
|
|
|
|
if bNotThrou then
|
|
|
|
|
return 2, dSawThick
|
|
|
|
|
return 2, dSawThick, dThick
|
|
|
|
|
end
|
|
|
|
|
return 1, dSawThick
|
|
|
|
|
return 1, dSawThick, dThick
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
@@ -1761,9 +1766,9 @@ local function MakeByCut( Proc, nRawId, b3Raw)
|
|
|
|
|
-- recupero la lavorazione con sega a catena
|
|
|
|
|
local sSawing = WM.FindSawing( 'Sawing')
|
|
|
|
|
-- recupero la lavorazione di fresatura
|
|
|
|
|
local sMilling, dMillMaxDepth = WM.FindMilling( 'FreeContour', dMaxWidth + WD.CUT_EXTRA)
|
|
|
|
|
local sMilling, dMillMaxDepth = WM.FindMilling( 'FreeContour', dMaxWidth + WD.CUT_EXTRA, nil, nil, nil, nil, true)
|
|
|
|
|
if not sMilling and ( not sSawing or bSlanting) then
|
|
|
|
|
sMilling = WM.FindMilling( 'FreeContour')
|
|
|
|
|
sMilling = WM.FindMilling( 'FreeContour', nil, nil, nil, nil, nil, true)
|
|
|
|
|
if not sMilling then
|
|
|
|
|
local sErr = 'Error : milling not found in library'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
@@ -1776,9 +1781,10 @@ local function MakeByCut( Proc, nRawId, b3Raw)
|
|
|
|
|
if nMlOk == 0 then return false, sMlErr end
|
|
|
|
|
-- se ci sono almeno due facce
|
|
|
|
|
if Proc.Fct >= 2 then
|
|
|
|
|
-- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante
|
|
|
|
|
-- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante e spessore sotto il limite
|
|
|
|
|
-- o con fresa cono piccola e spessore sotto il limite
|
|
|
|
|
if ( nConeCut == 1 and nMlOk == 1) or ( nConeCut == 2 and dThick <= ( WD.MAX_CLEAN_CRN30 + 20 * GEO.EPS_SMALL)) then
|
|
|
|
|
if ( nConeCut == 1 and nMlOk == 1 and dThick <= ( WD.MAX_CLEAN_CRN60 + 20 * GEO.EPS_SMALL)) or
|
|
|
|
|
( nConeCut == 2 and dThick <= ( WD.MAX_CLEAN_CRN30 + 20 * GEO.EPS_SMALL)) then
|
|
|
|
|
local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw,
|
|
|
|
|
sMlErr, nAddGrpId, dThick, nNewProc, 0,
|
|
|
|
|
true)
|
|
|
|
@@ -1786,8 +1792,14 @@ local function MakeByCut( Proc, nRawId, b3Raw)
|
|
|
|
|
else
|
|
|
|
|
-- messaggi nel log
|
|
|
|
|
if nConeCut == 1 then
|
|
|
|
|
local sErr = 'Clean corner 60° not applid because Milling not thru the thickness'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
if nMlOk ~= 1 then
|
|
|
|
|
local sErr = 'Clean corner 60° not applid because Milling not thru the thickness'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
else
|
|
|
|
|
local sErr = 'Clean corner 60° not applid because thickness: ' .. EgtNumToString( dThick, 2) ..
|
|
|
|
|
' is bigger than parameter MAX_CLEAN_CRN60: ' .. EgtNumToString( WD.MAX_CLEAN_CRN60 , 2)
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
end
|
|
|
|
|
elseif nConeCut == 2 then
|
|
|
|
|
local sErr = 'Clean corner 30° not applid because thickness: ' .. EgtNumToString( dThick, 2) ..
|
|
|
|
|
' is bigger than parameter MAX_CLEAN_CRN30: ' .. EgtNumToString( WD.MAX_CLEAN_CRN30 , 2)
|
|
|
|
@@ -1797,20 +1809,26 @@ local function MakeByCut( Proc, nRawId, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
-- altrimenti provo con la sega a catena
|
|
|
|
|
else
|
|
|
|
|
local nCsOk, sCSErr = AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
|
|
|
|
|
local nCsOk, sCSErr, dThick = AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
|
|
|
|
|
if nCsOk == 0 then return false, sCsErr end
|
|
|
|
|
-- se ci sono almeno due facce
|
|
|
|
|
if Proc.Fct >= 2 then
|
|
|
|
|
-- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante
|
|
|
|
|
if nConeCut == 1 and nCsOk == 1 then
|
|
|
|
|
-- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante e spessore sotto il limite
|
|
|
|
|
if nConeCut == 1 and nCsOk == 1 and dThick <= ( WD.MAX_CLEAN_CRN60 + 20 * GEO.EPS_SMALL) then
|
|
|
|
|
local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw,
|
|
|
|
|
sCSErr, nAddGrpId, nil, nNewProc, 0,
|
|
|
|
|
true)
|
|
|
|
|
if not bMcok then return bMcok, sMcErr end
|
|
|
|
|
else
|
|
|
|
|
if nConeCut == 1 then
|
|
|
|
|
local sErr = 'Clean corner 60° not applied because Sawing not thru the thickness'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
if nCsOk ~= 1 then
|
|
|
|
|
local sErr = 'Clean corner 60° not applied because Chainsawing not thru the thickness'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
else
|
|
|
|
|
local sErr = 'Clean corner 60° not applid because thickness: ' .. EgtNumToString( dThick, 2) ..
|
|
|
|
|
' is bigger than parameter MAX_CLEAN_CRN60: ' .. EgtNumToString( WD.MAX_CLEAN_CRN60 , 2)
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
end
|
|
|
|
|
elseif nConeCut == 2 then
|
|
|
|
|
local sErr = 'Not possible apply Clean corner 30° after use sawing'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
@@ -1846,7 +1864,7 @@ local function MakeByMill( Proc, nRawId, b3Raw)
|
|
|
|
|
local bToolInv = ( vtExtr:getZ() < -0.1)
|
|
|
|
|
local nTool_ID = EgtGetInfo( Proc.Id, 'CNT_DATA', 'i')
|
|
|
|
|
-- recupero la lavorazione
|
|
|
|
|
local sMilling = WM.FindMilling( 'FreeContour', nil, nil, nTool_ID)
|
|
|
|
|
local sMilling = WM.FindMilling( 'FreeContour', nil, nil, nTool_ID, nil, nil, true)
|
|
|
|
|
if not sMilling then
|
|
|
|
|
local sErr = 'Error : milling not found in library'
|
|
|
|
|
if nTool_ID then sErr = sErr .. ' (Tool_ID=' .. tostring( nTool_ID) .. ')' end
|
|
|
|
@@ -2086,10 +2104,8 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
|
|
|
|
|
-- recupero i dati della curva e del profilo
|
|
|
|
|
local dDepth = EgtIf( bPocketBotface, 0, abs( EgtCurveThickness( AuxId)))
|
|
|
|
|
local dOriDepth = dDepth
|
|
|
|
|
local nFacet
|
|
|
|
|
local dDiam
|
|
|
|
|
local dElev
|
|
|
|
|
-- cerco la faccia di fondo della superfice (deve avere direzione circa quella di estrusione della curva)
|
|
|
|
|
local nFacet
|
|
|
|
|
for i = 1, Proc.Fct do
|
|
|
|
|
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT)
|
|
|
|
|
if abs( vtN * vtExtr) > 0.99 then
|
|
|
|
@@ -2102,8 +2118,8 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
-- dati della faccia di fondo
|
|
|
|
|
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
|
|
|
|
|
dDiam = min( dH, dV)
|
|
|
|
|
dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId)
|
|
|
|
|
local dDiam = min( dH, dV)
|
|
|
|
|
local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId)
|
|
|
|
|
-- gruppo ausiliario
|
|
|
|
|
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
|
|
|
|
|
local nNewProc, nNumFacet = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacet)
|
|
|
|
@@ -2210,17 +2226,22 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
|
|
|
|
|
vFace, dMaxWidth, nNewProc = GetFacesData( Proc, bOpposite, false, dMillDiam, dMaxDepth, (dMillDiam/2), nAddGrpId, b3Raw, nNewProc)
|
|
|
|
|
-- se ci sono almeno due facce
|
|
|
|
|
if Proc.Fct >= 2 then
|
|
|
|
|
-- se abilitata la lavorazione corner con stop macchina e lavorazione precedente passante
|
|
|
|
|
if nConeCut == 1 then
|
|
|
|
|
-- se abilitata la lavorazione corner con stop macchina e affondamento non superiore al limite
|
|
|
|
|
local dDepthMach = EgtIf( bPocketBotface, dDepth, ( dDepth - dOriDepth))
|
|
|
|
|
if nConeCut == 1 and dDepthMach <= ( WD.MAX_CLEAN_CRN60 + 20 * GEO.EPS_SMALL) then
|
|
|
|
|
local bMcok, sMcErr = AddMillCorner( nConeCut, vFace, Proc, nRawId, b3Raw,
|
|
|
|
|
dMillDiam, nAddGrpId, nil, nNewProc, EgtIf( bPocketBotface, dDepth, ( dDepth - dOriDepth)))
|
|
|
|
|
dMillDiam, nAddGrpId, nil, nNewProc, dDepthMach)
|
|
|
|
|
if not bMcok then return bMcok, sMcErr end
|
|
|
|
|
elseif nConeCut == 2 then
|
|
|
|
|
local sErr = 'Clean corner 30° is not applied on pocketing'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
EgtErase( nNewProc)
|
|
|
|
|
else
|
|
|
|
|
EgtErase( nNewProc)
|
|
|
|
|
if nConeCut == 1 then
|
|
|
|
|
local sErr = 'Clean corner 60° not applid because thickness: ' .. EgtNumToString( dThick, 2) ..
|
|
|
|
|
' is bigger than parameter MAX_CLEAN_CRN60: ' .. EgtNumToString( WD.MAX_CLEAN_CRN60 , 2)
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
elseif nConeCut == 2 then
|
|
|
|
|
local sErr = 'Clean corner 30° is not applied on pocketing'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return true, sWarn
|
|
|
|
|