- in WallExec -> squadratura aggiunta funzione AddSquaring che verifica e aggiunge la squadratura in base al caso specifico

- in Squaring aggiunte funzioni per ricerca e controllo correttezza utensili in base al caso specifico
This commit is contained in:
luca.mazzoleni
2024-10-21 12:43:28 +02:00
parent d5e47c06fa
commit fdd114a8cd
2 changed files with 129 additions and 53 deletions
+92 -44
View File
@@ -13,51 +13,99 @@ EgtOutLog( ' Squaring started', 1)
local WD = require( 'WallData')
-------------------------------------------------------------------------------------------------------------
function Squaring.GetMachining( dDepth)
local Machining = {}
local nSquaringToolType = 0
if WD.SQUARING_EXTEND_Z and type( WD.SQUARING_EXTEND_Z) == "number" then
dDepth = dDepth + WD.SQUARING_EXTEND_Z
local function IsToolOk( Tool, dMachiningDepth)
local bIsToolOk = false
local bToolExists = false
local dToolMaxDepth = 0
bToolExists = Tool ~= {}
if bToolExists then
if Tool.nType == MCH_TY.MILL_NOTIP then
dToolMaxDepth = Tool.dThickness
else
dToolMaxDepth = Tool.dMaxDepth
end
end
bIsToolOk = bToolExists and ( dToolMaxDepth > dMachiningDepth - 10 * GEO.EPS_SMALL)
return bIsToolOk
end
-------------------------------------------------------------------------------------------------------------
function Squaring.GetTools()
local Tool = {}
local SquaringTools = {}
SquaringTools.Blade = {}
SquaringTools.Diskmill = {}
SquaringTools.Mill = {}
SquaringTools.Blade.H1 = {}
SquaringTools.Blade.H2 = {}
SquaringTools.Blade.H7 = {}
SquaringTools.Diskmill.H1 = {}
SquaringTools.Diskmill.H7 = {}
SquaringTools.Mill.H1 = {}
SquaringTools.Mill.H7 = {}
Tool.sName = EgtTdbGetFirstTool( MCH_TF.SAWBLADE + MCH_TF.MILL + MCH_TF.MORTISE)
while Tool.sName ~= '' do
EgtTdbSetCurrTool( Tool.sName)
local bToolLoadedOnSetup = EgtFindToolInCurrSetup( Tool.sName)
local bIsSquaringTool = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SQUARING', 'b') or false
Tool.nType = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
Tool.dThickness = EgtTdbGetCurrToolParam( MCH_TP.THICK)
Tool.dMaxMaterial = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
Tool.dMaxDepth = EgtTdbGetCurrToolMaxDepth() or Tool.dMaxMaterial
Tool.sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
Tool.bIsCcw = EgtTdbGetCurrToolParam( MCH_TP.SPEED) < 0
if bToolLoadedOnSetup and Tool.nType and bIsSquaringTool then
-- lame
if Tool.nType == MCH_TY.SAW_FLAT or Tool.nType == MCH_TY.SAW_STD then
SquaringTools.Blade[Tool.sHead] = Tool
-- frese standard
elseif Tool.nType == MCH_TY.MILL_STD then
SquaringTools.Mill[Tool.sHead] = Tool
-- truciolatori
elseif Tool.nType == MCH_TY.MILL_NOTIP then
SquaringTools.Diskmill[Tool.sHead] = Tool
end
end
Tool = {}
Tool.sName = EgtTdbGetNextTool( MCH_TF.SAWBLADE + MCH_TF.MILL + MCH_TF.MORTISE)
end
-- ricerca lavorazione di squadratura in base alle preferenze utente
if WD.SQUARING_TOOL and type( WD.SQUARING_TOOL) == "number" then
nSquaringToolType = WD.SQUARING_TOOL
end
-- lama
if nSquaringToolType == 0 or nSquaringToolType == 1 then
Machining.sSquaring = WM.FindCutting( 'Squaring', dDepth)
if Machining.sSquaring then
Machining.sType = 'Sawing'
end
end
-- fresa
if not Machining.sSquaring and ( nSquaringToolType == 0 or nSquaringToolType == 2) then
Machining.sSquaring = WM.FindMilling( 'Squaring', dDepth, nil, nil, nil, nil, true)
if Machining.sSquaring then
Machining.sType = 'Milling'
end
end
-- truciolatore
if not Machining.sSquaring and ( nSquaringToolType == 0 or nSquaringToolType == 3) then
Machining.sSquaring = WM.FindMilling( 'Squaring', nil, nil, nil, nil, nil, nil, dDepth)
if Machining.sSquaring then
Machining.sType = 'DiskMilling'
end
return SquaringTools
end
-------------------------------------------------------------------------------------------------------------
function Squaring.AreToolsOk( sSquaringTool, SquaringTools, dMachiningDepth)
local bAreToolsOk = false
if sSquaringTool == 'DoubleDiskmill' then
bAreToolsOk = ( IsToolOk( SquaringTools.Blade.H2, dMachiningDepth)
and IsToolOk( SquaringTools.Diskmill.H1, WD.SQUARING_MAX_OVERMATERIAL)
and IsToolOk( SquaringTools.Diskmill.H7, WD.SQUARING_MAX_OVERMATERIAL))
elseif sSquaringTool == 'DoubleDiskmillAndBlade' then
bAreToolsOk = ( IsToolOk( SquaringTools.Blade.H2, dMachiningDepth)
and ( IsToolOk( SquaringTools.Diskmill.H1, WD.SQUARING_MAX_OVERMATERIAL) or IsToolOk( SquaringTools.Diskmill.H7, WD.SQUARING_MAX_OVERMATERIAL)))
elseif sSquaringTool == 'DoubleBlade' then
bAreToolsOk = ( IsToolOk( SquaringTools.Blade.H2, dMachiningDepth)
and ( IsToolOk( SquaringTools.Blade.H1, dMachiningDepth) or IsToolOk( SquaringTools.Blade.H7, dMachiningDepth)))
elseif sSquaringTool == 'Diskmill' then
bAreToolsOk = IsToolOk( SquaringTools.Diskmill.H1, WD.SQUARING_MAX_OVERMATERIAL) or IsToolOk( SquaringTools.Diskmill.H7, WD.SQUARING_MAX_OVERMATERIAL)
elseif sSquaringTool == 'Blade' then
bAreToolsOk = IsToolOk( SquaringTools.Blade.H2, dMachiningDepth)
elseif sSquaringTool == 'DoubleMill' then
bAreToolsOk = IsToolOk( SquaringTools.Mill.H1, dMachiningDepth) and IsToolOk( SquaringTools.Mill.H7, dMachiningDepth)
elseif sSquaringTool == 'Mill' then
bAreToolsOk = IsToolOk( SquaringTools.Mill.H1, dMachiningDepth) or IsToolOk( SquaringTools.Mill.H7, dMachiningDepth)
else
error( 'Squaring Tool not recognized')
end
-- recupero informazioni utensile
local bIsToolCCW
if Machining.sSquaring and EgtMdbSetCurrMachining( Machining.sSquaring) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
local dSpeed = ( EgtTdbGetCurrToolParam( MCH_TP.SPEED))
bIsToolCCW = dSpeed < 0
end
end
Machining.bIsPathCW = ( not( bIsToolCCW) and Machining.sType == 'Milling') or ( bIsToolCCW and Machining.sType ~= 'Milling')
return Machining
return bAreToolsOk
end
-------------------------------------------------------------------------------------------------------------
@@ -86,7 +134,7 @@ function Squaring.CreateGeometry( RawPart, Machining)
local nRightLineId = EgtLine( RawPart.nId, pt2, pt3, GDB_RT.GLOB)
local nBackLinedId = EgtLine( RawPart.nId, pt3, pt4, GDB_RT.GLOB)
local nLeftLineId = EgtLine( RawPart.nId, pt4, pt1, GDB_RT.GLOB)
if Machining.sType == 'DiskMilling' or Machining.sType == 'Milling' then
if Machining.sType == 'Diskmilling' or Machining.sType == 'Milling' then
EgtModifyCurveExtrusion( nFrontLineId, -Y_AX(), GDB_RT.GLOB)
EgtModifyCurveExtrusion( nRightLineId, X_AX(), GDB_RT.GLOB)
EgtModifyCurveExtrusion( nBackLinedId, Y_AX(), GDB_RT.GLOB)
@@ -165,7 +213,7 @@ function Squaring.AddMachinings( Machining, SquaringGeometries, nFirstOperationI
EgtSetMachiningParam( MCH_MP.HEADSIDE, MCH_SAW_HS.LEFT)
elseif Machining.sType == 'Milling' then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
elseif Machining.sType == 'DiskMilling' then
elseif Machining.sType == 'Diskmilling' then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
EgtSetMachiningParam( MCH_MP.INVERT, true)
@@ -175,7 +223,7 @@ function Squaring.AddMachinings( Machining, SquaringGeometries, nFirstOperationI
EgtSetMachiningParam( MCH_MP.HEADSIDE, MCH_SAW_HS.RIGHT)
elseif Machining.sType == 'Milling' then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
elseif Machining.sType == 'DiskMilling' then
elseif Machining.sType == 'Diskmilling' then
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
end
EgtSetMachiningParam( MCH_MP.INVERT, false)