- in Squaring modifiche a GetTools e CreateGeometry per contemplare tutti i casi specifici
This commit is contained in:
+217
-92
@@ -58,17 +58,25 @@ function Squaring.GetTools()
|
||||
Tool.dMaxDepth = EgtTdbGetCurrToolMaxDepth() or Tool.dMaxMaterial
|
||||
Tool.sHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
|
||||
Tool.bIsCcw = EgtTdbGetCurrToolParam( MCH_TP.SPEED) < 0
|
||||
Tool.dFeed = EgtTdbGetCurrToolParam( MCH_TP.FEED)
|
||||
Tool.dStartFeed = EgtTdbGetCurrToolParam( MCH_TP.STARTFEED)
|
||||
Tool.dEndFeed = EgtTdbGetCurrToolParam( MCH_TP.ENDFEED)
|
||||
Tool.dTipFeed = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED)
|
||||
Tool.dMinFeed = EgtTdbGetCurrToolParam( MCH_TP.MINFEED)
|
||||
|
||||
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
|
||||
Tool.bIsPathCw = not Tool.bIsCcw
|
||||
-- frese standard
|
||||
elseif Tool.nType == MCH_TY.MILL_STD then
|
||||
SquaringTools.Mill[Tool.sHead] = Tool
|
||||
Tool.bIsPathCw = Tool.bIsCcw
|
||||
-- truciolatori
|
||||
elseif Tool.nType == MCH_TY.MILL_NOTIP then
|
||||
SquaringTools.Diskmill[Tool.sHead] = Tool
|
||||
Tool.bIsPathCw = not Tool.bIsCcw
|
||||
end
|
||||
end
|
||||
|
||||
@@ -109,9 +117,10 @@ function Squaring.AreToolsOk( sSquaringTool, SquaringTools, dMachiningDepth)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function Squaring.CreateGeometry( RawPart, Machining)
|
||||
function Squaring.CreateGeometry( sSquaringTool, SquaringTools, RawPart)
|
||||
-- TODO gestire squadratura sulle dimensioni massime dei pezzi (shrinktoparts) invece che sul master panel
|
||||
local SquaringGeometries = {}
|
||||
|
||||
local dDimX = RawPart.b3:getDimX()
|
||||
local dDimY = RawPart.b3:getDimY()
|
||||
local sOrigCorner = EgtGetInfo( RawPart.nId, 'ORIGCORNER')
|
||||
@@ -126,72 +135,166 @@ function Squaring.CreateGeometry( RawPart, Machining)
|
||||
dExtendZ = WD.SQUARING_EXTEND_Z
|
||||
end
|
||||
|
||||
local Front = { Side = 'Front'}
|
||||
local Right = { Side = 'Right'}
|
||||
local Back = { Side = 'Back'}
|
||||
local Left = { Side = 'Left'}
|
||||
local pt1 = RawPart.b3:getMin() + Point3d( -dOffsetXY, -dOffsetXY, -dExtendZ)
|
||||
local pt2 = pt1 + Point3d( dDimX + 2 * dOffsetXY, 0, 0)
|
||||
local pt3 = pt2 + Point3d( 0, dDimY + 2 * dOffsetXY,0 )
|
||||
local pt4 = pt3 + Point3d( -dDimX - 2 * dOffsetXY, 0, 0)
|
||||
local nFrontLineId = EgtLine( RawPart.nId, pt1, pt2, GDB_RT.GLOB)
|
||||
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
|
||||
EgtModifyCurveExtrusion( nFrontLineId, -Y_AX(), GDB_RT.GLOB)
|
||||
EgtModifyCurveExtrusion( nRightLineId, X_AX(), GDB_RT.GLOB)
|
||||
EgtModifyCurveExtrusion( nBackLinedId, Y_AX(), GDB_RT.GLOB)
|
||||
EgtModifyCurveExtrusion( nLeftLineId, -X_AX(), GDB_RT.GLOB)
|
||||
end
|
||||
EgtSetName( nFrontLineId, 'SquaringGeometry' )
|
||||
EgtSetName( nRightLineId, 'SquaringGeometry' )
|
||||
EgtSetName( nBackLinedId, 'SquaringGeometry' )
|
||||
EgtSetName( nLeftLineId, 'SquaringGeometry' )
|
||||
Front.nId = EgtLine( RawPart.nId, pt1, pt2, GDB_RT.GLOB)
|
||||
Right.nId = EgtLine( RawPart.nId, pt2, pt3, GDB_RT.GLOB)
|
||||
Back.nId = EgtLine( RawPart.nId, pt3, pt4, GDB_RT.GLOB)
|
||||
Left.nId = EgtLine( RawPart.nId, pt4, pt1, GDB_RT.GLOB)
|
||||
EgtModifyCurveExtrusion( Front.nId, -Y_AX(), GDB_RT.GLOB)
|
||||
EgtModifyCurveExtrusion( Right.nId, X_AX(), GDB_RT.GLOB)
|
||||
EgtModifyCurveExtrusion( Back.nId, Y_AX(), GDB_RT.GLOB)
|
||||
EgtModifyCurveExtrusion( Left.nId, -X_AX(), GDB_RT.GLOB)
|
||||
EgtSetName( Front.nId, 'SquaringGeometry')
|
||||
EgtSetName( Right.nId, 'SquaringGeometry')
|
||||
EgtSetName( Back.nId, 'SquaringGeometry')
|
||||
EgtSetName( Left.nId, 'SquaringGeometry')
|
||||
|
||||
for i = 1, 4 do
|
||||
SquaringGeometries[i] = {}
|
||||
-- in base al caso si assegna l'utensile al lato
|
||||
if sSquaringTool == 'DoubleDiskmill' then
|
||||
Left.Tool = SquaringTools.Diskmill.H1
|
||||
Right.Tool = SquaringTools.Blade.H2
|
||||
Front.Tool = SquaringTools.Diskmill.H1
|
||||
Front.ToolDouble = SquaringTools.Diskmill.H7
|
||||
elseif sSquaringTool == 'DoubleDiskmillAndBlade' then
|
||||
Left.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
|
||||
Right.Tool = SquaringTools.Blade.H2
|
||||
Front.Tool = SquaringTools.Blade.H2
|
||||
Front.ToolDouble = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
|
||||
elseif sSquaringTool == 'DoubleBlade' then
|
||||
Left.Tool = SquaringTools.Blade.H2
|
||||
Right.Tool = SquaringTools.Blade.H2
|
||||
Front.Tool = SquaringTools.Blade.H2
|
||||
Front.ToolDouble = SquaringTools.Blade.H1 or SquaringTools.Blade.H7
|
||||
elseif sSquaringTool == 'Diskmill' then
|
||||
Left.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
|
||||
Back.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
|
||||
Right.Tool = SquaringTools.Blade.H2
|
||||
Front.Tool = SquaringTools.Diskmill.H1 or SquaringTools.Diskmill.H7
|
||||
elseif sSquaringTool == 'Blade' then
|
||||
Left.Tool = SquaringTools.Blade.H2
|
||||
Back.Tool = SquaringTools.Blade.H2
|
||||
Right.Tool = SquaringTools.Blade.H2
|
||||
Front.Tool = SquaringTools.Blade.H2
|
||||
elseif sSquaringTool == 'DoubleMill' then
|
||||
Left.Tool = SquaringTools.Mill.H1
|
||||
Right.Tool = SquaringTools.Mill.H1
|
||||
Front.Tool = SquaringTools.Mill.H1
|
||||
Front.ToolDouble = SquaringTools.Mill.H7
|
||||
elseif sSquaringTool == 'Mill' then
|
||||
Left.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
|
||||
Back.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
|
||||
Right.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
|
||||
Front.Tool = SquaringTools.Mill.H1 or SquaringTools.Mill.H7
|
||||
end
|
||||
-- l'ordine di percorrenza delle linee dipende dal verso di percorrenza e, se attivato, dal riferimento utilizzato
|
||||
if Machining.bIsPathCW then
|
||||
if bSquaringStartsOnReference and ( sOrigCorner == 'BL' or sOrigCorner == 'BM') then
|
||||
SquaringGeometries[1].nId = nFrontLineId
|
||||
SquaringGeometries[2].nId = nLeftLineId
|
||||
SquaringGeometries[3].nId = nBackLinedId
|
||||
SquaringGeometries[4].nId = nRightLineId
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
|
||||
SquaringGeometries[1].nId = nBackLinedId
|
||||
SquaringGeometries[2].nId = nRightLineId
|
||||
SquaringGeometries[3].nId = nFrontLineId
|
||||
SquaringGeometries[4].nId = nLeftLineId
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
|
||||
SquaringGeometries[1].nId = nRightLineId
|
||||
SquaringGeometries[2].nId = nFrontLineId
|
||||
SquaringGeometries[3].nId = nLeftLineId
|
||||
SquaringGeometries[4].nId = nBackLinedId
|
||||
else
|
||||
SquaringGeometries[1].nId = nLeftLineId
|
||||
SquaringGeometries[2].nId = nBackLinedId
|
||||
SquaringGeometries[3].nId = nRightLineId
|
||||
SquaringGeometries[4].nId = nFrontLineId
|
||||
|
||||
-- l'ordinamento delle linee dipende dal verso di percorrenza e, se attivato, dal riferimento utilizzato
|
||||
-- con doppio l'ordine cambia
|
||||
-- lato lungo lavorato in doppio
|
||||
if not Back.Tool then
|
||||
for i = 1, 3 do
|
||||
SquaringGeometries[i] = {}
|
||||
end
|
||||
else
|
||||
if bSquaringStartsOnReference and ( sOrigCorner == 'TL' or sOrigCorner == 'TM') then
|
||||
SquaringGeometries[1].nId = nBackLinedId
|
||||
SquaringGeometries[2].nId = nLeftLineId
|
||||
SquaringGeometries[3].nId = nFrontLineId
|
||||
SquaringGeometries[4].nId = nRightLineId
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
|
||||
SquaringGeometries[1].nId = nRightLineId
|
||||
SquaringGeometries[2].nId = nBackLinedId
|
||||
SquaringGeometries[3].nId = nLeftLineId
|
||||
SquaringGeometries[4].nId = nFrontLineId
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
|
||||
SquaringGeometries[1].nId = nFrontLineId
|
||||
SquaringGeometries[2].nId = nRightLineId
|
||||
SquaringGeometries[3].nId = nBackLinedId
|
||||
SquaringGeometries[4].nId = nLeftLineId
|
||||
if Front.Tool.bIsPathCw then
|
||||
if bSquaringStartsOnReference and ( sOrigCorner == 'BL' or sOrigCorner == 'BM') then
|
||||
SquaringGeometries[1] = Front
|
||||
SquaringGeometries[2] = Left
|
||||
SquaringGeometries[3] = Right
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
|
||||
SquaringGeometries[1] = Right
|
||||
SquaringGeometries[2] = Front
|
||||
SquaringGeometries[3] = Left
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
|
||||
SquaringGeometries[1] = Right
|
||||
SquaringGeometries[2] = Front
|
||||
SquaringGeometries[3] = Left
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TL' or sOrigCorner == 'TM') then
|
||||
SquaringGeometries[1] = Left
|
||||
SquaringGeometries[2] = Front
|
||||
SquaringGeometries[3] = Right
|
||||
else
|
||||
SquaringGeometries[1] = Right
|
||||
SquaringGeometries[2] = Front
|
||||
SquaringGeometries[3] = Left
|
||||
end
|
||||
else
|
||||
SquaringGeometries[1].nId = nLeftLineId
|
||||
SquaringGeometries[2].nId = nFrontLineId
|
||||
SquaringGeometries[3].nId = nRightLineId
|
||||
SquaringGeometries[4].nId = nBackLinedId
|
||||
if bSquaringStartsOnReference and ( sOrigCorner == 'BL' or sOrigCorner == 'BM') then
|
||||
SquaringGeometries[1] = Left
|
||||
SquaringGeometries[2] = Front
|
||||
SquaringGeometries[3] = Right
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
|
||||
SquaringGeometries[1] = Front
|
||||
SquaringGeometries[2] = Right
|
||||
SquaringGeometries[3] = Left
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
|
||||
SquaringGeometries[1] = Front
|
||||
SquaringGeometries[2] = Right
|
||||
SquaringGeometries[3] = Left
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TL' or sOrigCorner == 'TM') then
|
||||
SquaringGeometries[1] = Left
|
||||
SquaringGeometries[2] = Front
|
||||
SquaringGeometries[3] = Right
|
||||
else
|
||||
SquaringGeometries[1] = Left
|
||||
SquaringGeometries[2] = Front
|
||||
SquaringGeometries[3] = Right
|
||||
end
|
||||
end
|
||||
-- doppio non attivo
|
||||
else
|
||||
for i = 1, 4 do
|
||||
SquaringGeometries[i] = {}
|
||||
end
|
||||
if Front.Tool.bIsPathCw then
|
||||
if bSquaringStartsOnReference and ( sOrigCorner == 'BL' or sOrigCorner == 'BM') then
|
||||
SquaringGeometries[1] = Front
|
||||
SquaringGeometries[2] = Left
|
||||
SquaringGeometries[3] = Back
|
||||
SquaringGeometries[4] = Right
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
|
||||
SquaringGeometries[1] = Back
|
||||
SquaringGeometries[2] = Right
|
||||
SquaringGeometries[3] = Front
|
||||
SquaringGeometries[4] = Left
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
|
||||
SquaringGeometries[1] = Right
|
||||
SquaringGeometries[2] = Front
|
||||
SquaringGeometries[3] = Left
|
||||
SquaringGeometries[4] = Back
|
||||
else
|
||||
SquaringGeometries[1] = Left
|
||||
SquaringGeometries[2] = Back
|
||||
SquaringGeometries[3] = Right
|
||||
SquaringGeometries[4] = Front
|
||||
end
|
||||
else
|
||||
if bSquaringStartsOnReference and ( sOrigCorner == 'TL' or sOrigCorner == 'TM') then
|
||||
SquaringGeometries[1] = Back
|
||||
SquaringGeometries[2] = Left
|
||||
SquaringGeometries[3] = Front
|
||||
SquaringGeometries[4] = Right
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'TR' or sOrigCorner == 'TN') then
|
||||
SquaringGeometries[1] = Right
|
||||
SquaringGeometries[2] = Back
|
||||
SquaringGeometries[3] = Left
|
||||
SquaringGeometries[4] = Front
|
||||
elseif bSquaringStartsOnReference and ( sOrigCorner == 'BR' or sOrigCorner == 'BN') then
|
||||
SquaringGeometries[1] = Front
|
||||
SquaringGeometries[2] = Right
|
||||
SquaringGeometries[3] = Back
|
||||
SquaringGeometries[4] = Left
|
||||
else
|
||||
SquaringGeometries[1] = Left
|
||||
SquaringGeometries[2] = Front
|
||||
SquaringGeometries[3] = Right
|
||||
SquaringGeometries[4] = Back
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -199,45 +302,67 @@ function Squaring.CreateGeometry( RawPart, Machining)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function Squaring.AddMachinings( Machining, SquaringGeometries, nFirstOperationId)
|
||||
function Squaring.AddMachinings( MachiningGeometries)
|
||||
local nNotOkCount = 0
|
||||
local sMsgTotal = ''
|
||||
|
||||
for i = 1, #SquaringGeometries do
|
||||
local nSquaringOperationId = EgtAddMachining('SQUARING', Machining.sSquaring)
|
||||
EgtSetMachiningGeometry( SquaringGeometries[i].nId)
|
||||
-- in base al verso di percorrenza modifico i parametri significativi di lavorazione
|
||||
if Machining.bIsPathCW then
|
||||
if Machining.sType == 'Sawing'then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_SAW_WS.LEFT)
|
||||
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
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
else
|
||||
if Machining.sType == 'Sawing' then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_SAW_WS.RIGHT)
|
||||
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
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, false)
|
||||
end
|
||||
local bOk = EgtApplyMachining( true, false)
|
||||
EgtRelocateGlob( nSquaringOperationId, nFirstOperationId, GDB_IN.BEFORE)
|
||||
if not bOk then
|
||||
local _, sMsg = EgtGetLastMachMgrError()
|
||||
nNotOkCount = nNotOkCount + 1
|
||||
sMsgTotal = sMsgTotal ..'\n' .. ( sMsg or '')
|
||||
end
|
||||
for i = 1, #MachiningGeometries do
|
||||
local nOperationId = EgtCreateMachining( 'SQUARING', MCH_AT.LINEAR, MACHININGS[i].Machining.sToolName)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return ( nNotOkCount < 1), sMsgTotal
|
||||
|
||||
|
||||
|
||||
-- for i = 1, #SquaringGeometries do
|
||||
-- local nSquaringOperationId = EgtAddMachining('SQUARING', Machining.sSquaring)
|
||||
-- EgtSetMachiningGeometry( SquaringGeometries[i].nId)
|
||||
-- -- in base al verso di percorrenza modifico i parametri significativi di lavorazione
|
||||
-- if Machining.bIsPathCw then
|
||||
-- if Machining.sType == 'Sawing'then
|
||||
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_SAW_WS.LEFT)
|
||||
-- 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
|
||||
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
|
||||
-- end
|
||||
-- EgtSetMachiningParam( MCH_MP.INVERT, true)
|
||||
-- else
|
||||
-- if Machining.sType == 'Sawing' then
|
||||
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_SAW_WS.RIGHT)
|
||||
-- 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
|
||||
-- EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
||||
-- end
|
||||
-- EgtSetMachiningParam( MCH_MP.INVERT, false)
|
||||
-- end
|
||||
-- local bOk = EgtApplyMachining( true, false)
|
||||
-- EgtRelocateGlob( nSquaringOperationId, nFirstOperationId, GDB_IN.BEFORE)
|
||||
-- if not bOk then
|
||||
-- local _, sMsg = EgtGetLastMachMgrError()
|
||||
-- nNotOkCount = nNotOkCount + 1
|
||||
-- sMsgTotal = sMsgTotal ..'\n' .. ( sMsg or '')
|
||||
-- end
|
||||
-- end
|
||||
|
||||
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user