- aggiunta gestione countersink e profili chamfer

- aggiunta materiali
- aggiunta possibilita' di creare svg su richiesta
- aggiunta gestione etichetta remnant
This commit is contained in:
Emmanuele Sassi
2023-10-05 13:06:40 +02:00
parent 04c7b07d0e
commit 173465984a
4 changed files with 250 additions and 18 deletions
+26 -2
View File
@@ -19,7 +19,9 @@ local Config = {}
-------------------------- Main -------------------------
-- path chiamate REST
Config.sRESTPath = "http://seriate.steamware.net:8082/NKC/api/"
--Config.sRESTPath = "http://iis01/NKC/api/"
--Config.sRESTPath = "http://seriate.steamware.net:8082/NKC/api/"
Config.sRESTPath = "http://iis01.egalware.com/NKC/api/"
Config.sPathMat = Config.sRESTPath .. "Material"
Config.sPathBatch = Config.sRESTPath .. "BatchProc"
-- Nesting cycle waiting time
@@ -43,6 +45,9 @@ Config.OutlineMachining = {{".375 ROUGHER", "ROUGHER"},
Config.HoleMachining = {"HOLE", {'3/16 DRILLING', '1/4 DRILLING', '1/2 DRILLING', '1/8 DRILLING', '11/32 DRILLING', '13/32 DRILLING',
'3/8 DRILLING', '5/16 DRILLING', '7/16 DRILLING', '17/32 DRILLING', '37/64 DRILLING'}}
Config.RampMachining = {"RAMP", '3/8 MILLING'}
Config.CountersinkMachining = {"COUNTERSINK", '45 DEG'}
Config.OutsideChamferMachining = {"OUTSIDE CHAMFER", '45 DEG'}
Config.InsideChamferMachining = {"INSIDECHAMFER", '45 DEG'}
-- list of pocketing machinings
Config.Pocketing = {'3/8 POCKETING', '1/4 POCKETING'}
@@ -57,6 +62,15 @@ Config.NWHoleMachTools = {'1/2 DRILLING', '1/8 DRILLING', '3/8 DRILLING', '5/16
Config.RampMachName = {"RAMP"}
Config.MXRampMachTools = {'3/8 MILLING'}
Config.NWRampMachTools = {'3/8 MILLING'}
Config.CountersinkMachName = {"COUNTERSINK"}
Config.MXCountersinkMachTools = {'45 DEG'}
Config.NWCountersinkMachTools = {'45 DEG'}
Config.InsideChamferMachName = {"INSIDE CHAMFER"}
Config.MXInsideChamferMachTools = {'45 DEG'}
Config.NWInsideChamferMachTools = {'45 DEG'}
Config.OutsideChamferMachName = {"OUTSIDE CHAMFER"}
Config.MXOutsideChamferMachTools = {'45 DEG'}
Config.NWOutsideChamferMachTools = {'45 DEG'}
Config.MXPocketingTools = {'3/8 POCKETING', '1/4 POCKETING'}
Config.NWPocketingTools = {'3/8 POCKETING', '1/4 POCKETING'}
@@ -94,6 +108,8 @@ Config.dSkeletonCut = 0.5
-- spessore scheletro pezzi piccoli
Config.dSkeletonWidth = 1 * 25.4
-- riduzione feed su pezzi con tab
Config.dTabFeed = 15000
-- riduzione feed su pezzi piccoli
Config.bSmallFeedReduce = true
Config.dSmallFeed = 8000
@@ -125,6 +141,10 @@ Config.TabParams = {{MatId = 1, MatExtCode = 6120, Length = 10.0, Height =
{MatId = 21, MatExtCode = 6115, Length = 10.0, Height = 2.0, Angle = 30, Distance = 60, MinCount = 3, MaxCount = 4},
{MatId = 24, MatExtCode = 108360, Length = 10.0, Height = 2.0, Angle = 30, Distance = 60, MinCount = 3, MaxCount = 4},
{MatId = 25, MatExtCode = 124880, Length = 10.0, Height = 2.0, Angle = 30, Distance = 60, MinCount = 3, MaxCount = 4},
{MatId = 26, MatExtCode = 127662, Length = 10.0, Height = 2.0, Angle = 30, Distance = 60, MinCount = 3, MaxCount = 4},
{MatId = 27, MatExtCode = 127663, Length = 10.0, Height = 2.0, Angle = 30, Distance = 60, MinCount = 3, MaxCount = 4},
{MatId = 28, MatExtCode = 127664, Length = 10.0, Height = 2.0, Angle = 30, Distance = 60, MinCount = 3, MaxCount = 4},
{MatId = 29, MatExtCode = 127665, Length = 10.0, Height = 2.0, Angle = 30, Distance = 60, MinCount = 3, MaxCount = 4},
}
-- parts minimum distance from raw part outline for each material
@@ -149,8 +169,12 @@ Config.Kerf = {{MatId = 1, MatExtCode = 6120, Kerf = 8},
{MatId = 19, MatExtCode = 6117, Kerf = 20},
{MatId = 20, MatExtCode = 6119, Kerf = 20},
{MatId = 21, MatExtCode = 6115, Kerf = 20},
{MatId = 24, MatExtCode = 108360, Kerf = 20},
{MatId = 24, MatExtCode = 108360, Kerf = 8},
{MatId = 25, MatExtCode = 124880, Kerf = 20},
{MatId = 26, MatExtCode = 127662, Kerf = 20},
{MatId = 27, MatExtCode = 127663, Kerf = 20},
{MatId = 28, MatExtCode = 127664, Kerf = 20},
{MatId = 29, MatExtCode = 127665, Kerf = 20},
}
Config.KitXModel = {{Model = '65w981', KitQty = 6},
+3 -3
View File
@@ -19,7 +19,7 @@ package.cpath = package.cpath .. ";/EgtDevTest/LUAREST/32/?.lua"
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( true)
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Nesting
local sBaseDir = EgtGetSourceDir()
@@ -34,7 +34,7 @@ local socket = require( 'socket')
------------------------------------------- PARAMETERS -------------------------------------------
local DebugCode = false
local ProblematicItem = 67328
local ProblematicItem = 138284
------------------------------------------- ************** -------------------------------------------
@@ -856,7 +856,7 @@ function Estimate(readBatch)
PartCount = PartCount + 1
local TempPart = readBatch.OrderList[Order].KitList[Kit].PartList[Part]
-- leggo le proprietà dal dxf e le imposto
local MatExtCode, PdfLink, Paint, OptParameters, ErrorType = UtilityLib.readDXF(TempPart.CadFilePath, TempPart.PartExtCode, true)
local MatExtCode, PdfLink, Paint, OptParameters, ErrorType = UtilityLib.readDXF(TempPart.CadFilePath, TempPart.PartExtCode, true, readBatch.CreatePng)
-- solo se trovo il materiale vado avanti per questo pezzo
if ErrorType == 0 and MatExtCode then
TempPart.MatExtCode = MatExtCode
+215 -10
View File
@@ -23,7 +23,7 @@ local UtilityLib = require( 'UtilityLib')
------------------------------------------- PARAMETERS -------------------------------------------
local DebugCode = false
local ProblematicItem = 67328
local ProblematicItem = 138284
local OrderXCart = 1 -- ordini che si possono mettere su un carrello
local KitXCart = 6 -- kit che si possono mettere su un carrello
@@ -52,6 +52,9 @@ local OutlineMachining = {} --{{".375 ROUGHER", "ROUGHER"}, {'3/8 MILLING', '1/4
local HoleMachining = {} --{"HOLE", {'3/16 DRILLING', '1/4 DRILLING', '1/2 DRILLING', '1/8 DRILLING', '11/32 DRILLING', '13/32 DRILLING',
-- '3/8 DRILLING', '5/16 DRILLING', '7/16 DRILLING', '17/32 DRILLING', '37/64 DRILLING'}}
local RampMachining = {} -- {"RAMP", '3/8 MILLING'} --, '1/4 MILLING'}}
local OutsideChamferMachining = {} -- {"COUNTERSINK", '45 DEG'} --, '1/4 MILLING'}}
local InsideChamferMachining = {} -- {"COUNTERSINK", '45 DEG'} --, '1/4 MILLING'}}
local CountersinkMachining = {} -- {"COUNTERSINK", '45 DEG'} --, '1/4 MILLING'}}
local Pocketing = {} -- {'3/8 POCKETING', '1/4 POCKETING'}
local sCurrMachName = ""
local IsOffline = false
@@ -65,6 +68,7 @@ local IntExtOutlineList = {}
local InternalOutlineList = {}
local PocketingList = {}
local RampList = {}
local ChamferList = {}
local HoleList = {}
-- funzione che legge i dxf con le proprieta' dei pezzi
@@ -519,6 +523,9 @@ end
local AREA = "Area"
local OUTLINE = "Outline"
local HOLE = "HOLE"
local INSIDECHAMFER = "INSIDE CHAMFER"
local OUTSIDECHAMFER = "OUTSIDE CHAMFER"
local COUNTERSINK = "COUNTERSINK"
local PARTID = "PartId"
local PRIORITY = "Priority"
local DTMXPOS = "DATA MATRIX CODE POSITION"
@@ -535,7 +542,7 @@ local function AddPartListToNesting(PartList, ErrorList, Material)
-- tipo di rotazione del pezzo consentita : 0 -> rotazione libera, 1 -> rotazione solo di 180°, 2 -> nessuna rotazione
local RotationType = 0
-- verifico se gia' presente per importazione precedente
local PartId1 = EgtGetFirstNameInGroup(GDB_ID.ROOT, PartList[Part].PartId)
local PartId1 = EgtGetFirstNameInGroup(GDB_ID.ROOT, PartList[Part].PartDtmx)
if not PartId1 then
-- importo il dxf del pezzo
DXFpath = string.gsub(PartList[Part].CadFilePath, "\\", '/')
@@ -823,7 +830,24 @@ local function AddPartListToNesting(PartList, ErrorList, Material)
nPointId = EgtGetNext(nPointId)
end
EgtSetStatus(LayerId, GDB_ST.ON)
elseif layerName == OUTLINE or layerName == HOLE or layerName == CARTBININFO or layerName == RAMP then
elseif layerName == OUTSIDECHAMFER then
if PartList[Part].OptParameters.OutsideChamferWidth then
local nChamferId = EgtGetFirstInGroup( LayerId)
while nChamferId do
EgtSetInfo( nChamferId, 'ChamferWidth', PartList[Part].OptParameters.OutsideChamferWidth)
nChamferId = EgtGetNext(nChamferId)
end
end
elseif layerName == INSIDECHAMFER then
if PartList[Part].OptParameters.InsideChamferWidth then
local nChamferId = EgtGetFirstInGroup( LayerId)
while nChamferId do
EgtSetInfo( nChamferId, 'ChamferWidth', PartList[Part].OptParameters.InsideChamferWidth)
nChamferId = EgtGetNext(nChamferId)
end
end
EgtSetStatus(LayerId, GDB_ST.ON)
elseif layerName == OUTLINE or layerName == HOLE or layerName == CARTBININFO or layerName == RAMP or layerName == COUNTERSINK then
EgtSetStatus(LayerId, GDB_ST.ON)
else
EgtSetStatus(LayerId, GDB_ST.OFF)
@@ -977,6 +1001,7 @@ local function CreateMachSheets(LastMachGroupId, SheetPartId, Material, PartList
table.insert(Sheet.PartList, {PartId = EgtGetInfo(PartId, PARTID)})
if tonumber(EgtGetInfo(PartId, PARTID)) == ProblematicItem then
local x = 2
--EgtSaveFile("c:/Temp/ProvaNesting2.nge")
end
-- lo elimino dalla lista pezzi
local PartIndex = 0
@@ -997,6 +1022,7 @@ end
--
local SHEETLABEL = "SheetLabel"
local REMNANTLABEL = "RemnantLabel"
-- funzione che nesta i pezzi passatigli dato un grezzo di partenza e/o un materiale
-- LastRaw: grezzo incompleto da riempire
-- PartList: lista dei pezzi da nestare
@@ -1005,6 +1031,15 @@ function NestingLib.NestPartInRawPart(LastRaw, PartList, Material, ErrorList, Is
-- inizio nesting automatico
EgtAutoNestStart()
local nOldMachGroup = EgtGetCurrMachGroup()
EgtResetCurrMachGroup()
-- aggiungo tutti i pezzi al nesting
AddPartListToNesting(PartList, ErrorList, Material)
-- ripristino MachGroup
EgtSetCurrMachGroup(nOldMachGroup)
-- creo pannello del materiale
local SheetPartId = EgtGroup(GDB_ID.ROOT)
EgtSetName(SheetPartId, "Sheet")
@@ -1066,12 +1101,9 @@ function NestingLib.NestPartInRawPart(LastRaw, PartList, Material, ErrorList, Is
EgtAutoNestAddDefectToSheet(SheetPartId, nSheetLabel) -- EgtAutoNestAddDefectToSheet( SheetId, DefectId)
end
-- aggiungo tutti i pezzi al nesting
AddPartListToNesting(PartList, ErrorList, Material)
if #ErrorList > 0 then return end
-- recupero diametro utensile usato per outline
local ToolDiam = 0
local x = EgtGetCurrMachineName()
if EgtMdbSetCurrMachining(OutlineMachining[2][1]) then
local ToolName = EgtMdbGetCurrMachiningParam(MCH_MP.TOOL)
EgtTdbSetCurrTool(ToolName)
@@ -1237,7 +1269,7 @@ local function SortParts(PartList, bZigZagSorting)
end
--
local function ProcessMachinings(HoleList, RampList, PocketingList, IntIntOutlineList, SkinOutlineList, IntExtOutlineList, InternalOutlineList, SmallOutlineList, OutlineList, LastMch)
local function ProcessMachinings(HoleList, RampList, ChamferList, PocketingList, IntIntOutlineList, SkinOutlineList, IntExtOutlineList, InternalOutlineList, SmallOutlineList, OutlineList, LastMch)
if not LastMch then
local nPhase = EgtGetCurrPhase()
LastMch = EgtGetPhaseDisposition( nPhase)
@@ -1247,6 +1279,7 @@ local function ProcessMachinings(HoleList, RampList, PocketingList, IntIntOutlin
LastMch = SortCuts(HoleList[HoleMach], LastMch)
end
LastMch = SortCuts(RampList, LastMch)
LastMch = SortCuts(ChamferList, LastMch)
LastMch = SortCuts(PocketingList, LastMch)
LastMch = SortCuts(IntIntOutlineList, LastMch)
LastMch = SortCuts(SkinOutlineList, LastMch)
@@ -1392,6 +1425,20 @@ function NestingLib.PostNestOp(Material, ErrorList, IsEstimate, BatchId, MachId)
local RemnantCutLayer = EgtGroup(RemnantCutPart)
local RemnantCutLine = EgtLine(RemnantCutLayer, Point3d(0, 0, 0),
Point3d(0, SheetBBox:getDimY(), 0))
-- aggiungo etichetta remnant
local dLabelW = 50
local dLabelH = 25
local dYPos = Material.W_mm
if Material.W_mm > 1465 then
dYPos = 1465 + (dLabelH)
end
local nRemnantLabel = EgtRectangle2P(RemnantCutLayer, Point3d(20, dYPos - dLabelH, 0), Point3d(20 + dLabelW, dYPos, 0), GDB_RT.GLOB)
EgtSetName(nRemnantLabel, REMNANTLABEL)
local sMaterial = string.format('%08d', Material.MatExtCode)
local sRemnantDim = string.format('%08d', tointeger(floor(RemnantMultiple * Config.RemnantMinDimension * 1000)))
EgtSetInfo(RemnantCutLayer, "DTMX", "MT" .. sMaterial .. "-" .. sRemnantDim)
local sRemnantDimText = string.format('%.1f', RemnantMultiple * Config.RemnantMinDimension / 25.4)
EgtSetInfo(RemnantCutLayer, "TEXT", sRemnantDimText)
-- lo aggiungo come pezzo al grezzo
EgtAddPartToRawPart(RemnantCutPart, Point3d(RemnantCutXPos, 0, 0), CurrRawPart)
-- lo lavoro
@@ -1486,6 +1533,8 @@ function NestingLib.PostNestOp(Material, ErrorList, IsEstimate, BatchId, MachId)
EgtSetMachiningParam(MCH_MP.STARTADDLEN , (- dSkeletonCutLength + 1) / 2)
EgtSetMachiningParam(MCH_MP.ENDADDLEN , (- dSkeletonCutLength + 1) / 2)
end
-- aggiungo ingresso a zig zag
EgtSetMachiningParam(MCH_MP.LEADINTYPE , MCH_MILL_LI.ZIGZAG)
-- applico la lavorazione
if not EgtApplyMachining() then
table.insert(ErrorList, {ErrType = "E.7", Uid = "Skeleton separation cut", Description = "Error in horizontal skeleton machining!"})
@@ -1533,6 +1582,8 @@ function NestingLib.PostNestOp(Material, ErrorList, IsEstimate, BatchId, MachId)
EgtSetMachiningParam(MCH_MP.STARTADDLEN , (- dSkeletonCutLength + 1) / 2)
EgtSetMachiningParam(MCH_MP.ENDADDLEN , (- dSkeletonCutLength + 1) / 2)
end
-- aggiungo ingresso a zig zag
EgtSetMachiningParam(MCH_MP.LEADINTYPE , MCH_MILL_LI.ZIGZAG)
-- applico la lavorazione
if not EgtApplyMachining() then
table.insert(ErrorList, {ErrType = "E.7", Uid = "Skeleton separation cut", Description = "Error in vertical skeleton machining!"})
@@ -1835,7 +1886,7 @@ function CreateMachByType(Material, CurrRawPart, PartsBBox, nSkeletonLayerId, Pa
CurrPart = EgtGetNextPartInRawPart(CurrPart)
end
-- ordino lavorzioni con algoritmo ts
ProcessMachinings(HoleList, RampList, PocketingList, IntIntOutlineList, SkinOutlineList, IntExtOutlineList, InternalOutlineList, SmallOutlineList, OutlineList)
ProcessMachinings(HoleList, RampList, ChamferList, PocketingList, IntIntOutlineList, SkinOutlineList, IntExtOutlineList, InternalOutlineList, SmallOutlineList, OutlineList)
return PartsArea
end
@@ -2014,6 +2065,7 @@ function ResetSPMachList()
InternalOutlineList = {}
PocketingList = {}
RampList = {}
ChamferList = {}
HoleList = {}
for HoleMach = 1, (#HoleMachining[2] + #Pocketing) do
table.insert(HoleList, {})
@@ -2082,7 +2134,7 @@ function CalcPartMachinings(Material, CurrPart, bInternalPart, LastMch, nMachTyp
elseif nCurrMode == 2 or nCurrMode == 4 then
-- abilito tab
EgtSetMachiningParam(MCH_MP.LEAVETAB, true)
EgtSetMachiningParam(MCH_MP.FEED, 8000)
EgtSetMachiningParam(MCH_MP.FEED, Config.dTabFeed)
for CurrMat = 1, #Config.TabParams do
if Config.TabParams[CurrMat].MatExtCode == Material.MatExtCode then
EgtSetMachiningParam(MCH_MP.TABLEN, Config.TabParams[CurrMat].Length)
@@ -2118,6 +2170,8 @@ function CalcPartMachinings(Material, CurrPart, bInternalPart, LastMch, nMachTyp
if Config.bSmallFeedReduce and dGeomArea < 11612 then -- 3225 then
EgtSetMachiningParam(MCH_MP.FEED, Config.dSmallFeed)
end
-- imposto elevazione a spessore + 2
-- EgtSetMachiningParam(MCH_MP.LIELEV, Material.T_mm + 2)
-- applico la lavorazione
if EgtApplyMachining() then
bValidOutlineMach = true
@@ -2166,6 +2220,8 @@ function CalcPartMachinings(Material, CurrPart, bInternalPart, LastMch, nMachTyp
EgtSetMachiningParam(MCH_MP.TABMAX, 16)
EgtSetMachiningParam(MCH_MP.TABDIST, 30000)
-- end
-- imposto elevazione a spessore + 2
-- EgtSetMachiningParam(MCH_MP.LIELEV, Material.T_mm + 2)
-- applico la lavorazione
if EgtApplyMachining() then
bValidOutlineMach = true
@@ -2348,10 +2404,147 @@ function CalcPartMachinings(Material, CurrPart, bInternalPart, LastMch, nMachTyp
CurrGeom = EgtGetNext(CurrGeom)
end
end
-- cerco layer Countersink
local CountersinkLayer = EgtGetFirstNameInGroup(CurrPart, CountersinkMachining[1])
-- se lo trovo
if CountersinkLayer then
-- verifico le geometrie presenti
local CurrGeom = EgtGetFirstInGroup(CountersinkLayer)
while CurrGeom do
-- se non e' gia' percorso di lavorazione
if not EgtGetInfo(CurrGeom, MACHPATH) then
-- se e' arco
if EgtGetType(CurrGeom) == GDB_TY.CRV_ARC then
local NewMachId = EgtAddMachining(CountersinkMachining[1], CountersinkMachining[2])
EgtSetMachiningGeometry(CurrGeom)
local dRadius = EgtArcRadius( CurrGeom)
local dMaxWidth = ( dRadius * 2) - 1
local ToolDiam = 0
local ToolHeight = 0
if EgtMdbSetCurrMachining(OutsideChamferMachining[2]) then
local ToolName = EgtMdbGetCurrMachiningParam(MCH_MP.TOOL)
EgtTdbSetCurrTool(ToolName)
ToolDiam = EgtTdbGetCurrToolParam(MCH_TP.TOTDIAM)
ToolHeight = EgtTdbGetCurrToolParam(MCH_TP.MAXMAT)
end
local dDepth = min( dMaxWidth / 2, Material.T_mm, ToolDiam / 2, ToolHeight)
local dRadial = dDepth
EgtSetMachiningParam(MCH_MP.DEPTH, dDepth)
EgtSetMachiningParam(MCH_MP.OFFSR, dRadial)
EgtSetMachiningParam(MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- applico la lavorazione
if EgtApplyMachining() then
bValidOutlineMach = true
InitInTSP(NewMachId, InternalOutlineList, 0)
end
if not bValidOutlineMach then
local PartId = EgtGetInfo(CurrPart, PARTID)
if not PartId then PartId = "" end
table.insert(ErrorList, {ErrType = "E.7", Uid = "PartId = " .. PartId, Description = "Error in Countersink machining!"})
end
end
end
CurrGeom = EgtGetNext(CurrGeom)
end
end
-- cerco layer Outside Chamfer
local OutsideChamferLayer = EgtGetFirstNameInGroup(CurrPart, OutsideChamferMachining[1])
-- se lo trovo
if OutsideChamferLayer then
-- verifico le geometrie presenti
local CurrGeom = EgtGetFirstInGroup(OutsideChamferLayer)
while CurrGeom do
-- se non e' gia' percorso di lavorazione
if not EgtGetInfo(CurrGeom, MACHPATH) then
-- se e' curva composita
if EgtGetType(CurrGeom) == GDB_TY.CRV_COMPO then
local dChamferWidth = EgtGetInfo( CurrGeom, 'ChamferWidth', 'd')
-- se trovo info spessore del chamfer
if dChamferWidth then
-- creo lavorazione
local NewMachId = EgtAddMachining(OutsideChamferMachining[1], OutsideChamferMachining[2])
EgtSetMachiningGeometry(CurrGeom)
-- calcolo affondamento ed offset radiale
dChamferWidth = dChamferWidth
local dMaxWidth = dChamferWidth + 8
local ToolDiam = 0
if EgtMdbSetCurrMachining(OutsideChamferMachining[2]) then
local ToolName = EgtMdbGetCurrMachiningParam(MCH_MP.TOOL)
EgtTdbSetCurrTool(ToolName)
ToolDiam = EgtTdbGetCurrToolParam(MCH_TP.TOTDIAM)
end
local dDepth = min( dMaxWidth / 2, Material.T_mm, ToolDiam / 2)
local dRadial = dDepth - dChamferWidth
EgtSetMachiningParam(MCH_MP.DEPTH, dDepth)
EgtSetMachiningParam(MCH_MP.OFFSR, dRadial)
EgtSetMachiningParam(MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
-- applico la lavorazione
if EgtApplyMachining() then
bValidOutlineMach = true
InitInTSP(NewMachId, InternalOutlineList, 0)
end
if not bValidOutlineMach then
local PartId = EgtGetInfo(CurrPart, PARTID)
if not PartId then PartId = "" end
table.insert(ErrorList, {ErrType = "E.7", Uid = "PartId = " .. PartId, Description = "Error in OutsideChamfer machining!"})
end
end
end
end
CurrGeom = EgtGetNext(CurrGeom)
end
end
-- cerco layer Inside Chamfer
local InsideChamferLayer = EgtGetFirstNameInGroup(CurrPart, InsideChamferMachining[1])
-- se lo trovo
if InsideChamferLayer then
-- verifico le geometrie presenti
local CurrGeom = EgtGetFirstInGroup(InsideChamferLayer)
while CurrGeom do
-- se non e' gia' percorso di lavorazione
if not EgtGetInfo(CurrGeom, MACHPATH) then
-- se e' curva composita
if EgtGetType(CurrGeom) == GDB_TY.CRV_COMPO then
local dChamferWidth = EgtGetInfo( CurrGeom, 'ChamferWidth', 'd')
-- se trovo info spessore del chamfer
if dChamferWidth then
-- creo lavorazione
local NewMachId = EgtAddMachining(InsideChamferMachining[1], InsideChamferMachining[2])
EgtSetMachiningGeometry(CurrGeom)
-- calcolo affondamento ed offset radiale
dChamferWidth = dChamferWidth
local dMaxWidth = dChamferWidth + 8
local ToolDiam = 0
if EgtMdbSetCurrMachining(InsideChamferMachining[2]) then
local ToolName = EgtMdbGetCurrMachiningParam(MCH_MP.TOOL)
EgtTdbSetCurrTool(ToolName)
ToolDiam = EgtTdbGetCurrToolParam(MCH_TP.TOTDIAM)
end
local dDepth = min( dMaxWidth / 2, Material.T_mm, ToolDiam / 2)
local dRadial = dDepth - dChamferWidth
EgtSetMachiningParam(MCH_MP.DEPTH, dDepth)
EgtSetMachiningParam(MCH_MP.OFFSR, dRadial)
EgtSetMachiningParam(MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
-- applico la lavorazione
if EgtApplyMachining() then
bValidOutlineMach = true
InitInTSP(NewMachId, InternalOutlineList, 0)
end
if not bValidOutlineMach then
local PartId = EgtGetInfo(CurrPart, PARTID)
if not PartId then PartId = "" end
table.insert(ErrorList, {ErrType = "E.7", Uid = "PartId = " .. PartId, Description = "Error in InsideChamfer machining!"})
end
end
end
end
CurrGeom = EgtGetNext(CurrGeom)
end
end
end
if bDoCalc then
-- ordino lavorzioni con algoritmo ts
return ProcessMachinings(HoleList, RampList, PocketingList, IntIntOutlineList, SkinOutlineList, IntExtOutlineList, InternalOutlineList, SmallOutlineList, OutlineList, LastMch)
return ProcessMachinings(HoleList, RampList, ChamferList, PocketingList, IntIntOutlineList, SkinOutlineList, IntExtOutlineList, InternalOutlineList, SmallOutlineList, OutlineList, LastMch)
end
end
@@ -2465,6 +2658,9 @@ function NestingLib.ManageMachine(CurrIsOffline)
OutlineMachining = {}
HoleMachining = {}
RampMachining = {}
CountersinkMachining = {}
OutsideChamferMachining = {}
InsideChamferMachining = {}
Pocketing = {}
IsOffline = false
-- aggiungo liste nomi layer in prima posizione
@@ -2473,6 +2669,9 @@ function NestingLib.ManageMachine(CurrIsOffline)
-- table.insert(RampMachining, 1, Config.RampMachName)
HoleMachining[1] = Config.HoleMachName[1]
RampMachining[1] = Config.RampMachName[1]
CountersinkMachining[1] = Config.CountersinkMachName[1]
OutsideChamferMachining[1] = Config.OutsideChamferMachName[1]
InsideChamferMachining[1] = Config.InsideChamferMachName[1]
-- se offline imposto lavorazioni macchina NorthWood
if CurrIsOffline then
sCurrMachName = "Northwood-RHD"
@@ -2480,6 +2679,9 @@ function NestingLib.ManageMachine(CurrIsOffline)
table.insert(OutlineMachining, 2, Config.NWOutlineMachTools)
table.insert(HoleMachining, 2, Config.NWHoleMachTools)
table.insert(RampMachining, 2, Config.NWRampMachTools[1])
table.insert(CountersinkMachining, 2, Config.NWCountersinkMachTools)
table.insert(OutsideChamferMachining, 2, Config.MXOutsideChamferMachTools)
table.insert(InsideChamferMachining, 2, Config.NWInsideChamferMachTools[1])
Pocketing = Config.NWPocketingTools
IsOffline = true
else
@@ -2488,6 +2690,9 @@ function NestingLib.ManageMachine(CurrIsOffline)
table.insert(OutlineMachining, 2, Config.MXOutlineMachTools)
table.insert(HoleMachining, 2, Config.MXHoleMachTools)
table.insert(RampMachining, 2, Config.MXRampMachTools[1])
table.insert(CountersinkMachining, 2, Config.MXCountersinkMachTools[1])
table.insert(OutsideChamferMachining, 2, Config.MXOutsideChamferMachTools[1])
table.insert(InsideChamferMachining, 2, Config.MXInsideChamferMachTools[1])
Pocketing = Config.MXPocketingTools
IsOffline = false
end
+6 -3
View File
@@ -124,14 +124,16 @@ local PDF = {"PDF LINK"}
local CUTOPT = {"CUT OPT", "CutOpt"}
local LABEL = {"LABEL", "Label"}
local NAME = {"NAME", "Name"}
local INCHAMFER = {"INSIDE CHAMFER WIDTH", "InsideChamferWidth"}
local OUTCHAMFER = {"OUTSIDE CHAMFER WIDTH", "OutsideChamferWidth"}
local DXFFlags = {MATERIAL, PAINT, ASSEMBLY, TNUT, ROUND, TAB, PDF, CUTOPT, LABEL, NAME}
local DXFFlags = {MATERIAL, PAINT, ASSEMBLY, TNUT, ROUND, TAB, PDF, CUTOPT, LABEL, NAME, INCHAMFER, OUTCHAMFER}
-- funzione che legge i dxf
-- valore di ritorno numero 5 e' ErrorType:
-- 1) File not found
-- 2) Material layer not found
function UtilityLib.readDXF(DXFpath, PartExtCode, IsEstimation)
function UtilityLib.readDXF(DXFpath, PartExtCode, IsEstimation, CreatePng)
-- elimino doppie barre dalla path
DXFpath = string.gsub(DXFpath, "\\", '/')
local errorType = 0
@@ -191,7 +193,7 @@ function UtilityLib.readDXF(DXFpath, PartExtCode, IsEstimation)
end
end
end
if IsEstimation and paint then
if ( IsEstimation and paint) or CreatePng then
-- verifico se gia' processato
local Index = 1
local bFound = false
@@ -242,6 +244,7 @@ function SavePartImage(PartExtCode)
-- EgtMove(nPartId, Vector3d(- (b3PartId:getDimX() / 2), - (b3PartId:getDimY() / 2), 0))
EgtZoom(SCE_ZM.ALL)
EgtGetImage( SCE_SM.SH, WHITE(), WHITE(), 1600, 1000, PNGPath .. "/" .. PartExtCode .. ".png")
EgtGetImage( SCE_SM.SH, WHITE(), WHITE(), 2000, 800, PNGPath .. "/" .. PartExtCode .. "_SP.png")
-- EgtSaveFile(PNGPath .. "/" .. PartExtCode .. ".nge")
end
--