Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 42a4479df7 | |||
| 708307d345 |
@@ -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()
|
||||
@@ -1090,6 +1090,12 @@ function ExtendedEstimate(readBatch)
|
||||
end
|
||||
--
|
||||
|
||||
-- verifico che non ci siano istanze gia' in corso
|
||||
if not EgtCreateMutex('Global\\MainNKCLuaScript') then
|
||||
EgtOutLog( 'Impossible starting script! Script already in execution!')
|
||||
EgtOutBox( 'Script already running! Impossible running another instance at the same time!!', 'Error' , 'ERROR', 'OK')
|
||||
EgtCloseExe()
|
||||
end
|
||||
-- ciclo principale
|
||||
while true do
|
||||
EgtNewFile()
|
||||
@@ -1115,5 +1121,5 @@ while true do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
EgtReleaseMutex()
|
||||
|
||||
+3
-40
@@ -537,12 +537,8 @@ local SKELETONPART = "SKELETON"
|
||||
local CUTOPT = "CUTOPT"
|
||||
-- funzione legge il dxf ed aggiunge il pezzo al nesting
|
||||
local function AddPartListToNesting(PartList, ErrorList, Material)
|
||||
local BigPartsQty = 0
|
||||
local LastId = GDB_ID.ROOT
|
||||
for Part = 1, #PartList do
|
||||
if PartList[Part].PartExtCode == '128057' then
|
||||
local f = 3
|
||||
end
|
||||
-- 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
|
||||
@@ -714,10 +710,6 @@ local function AddPartListToNesting(PartList, ErrorList, Material)
|
||||
RotationType = 1
|
||||
end
|
||||
EgtSetName(nMaxId, OUTLINE)
|
||||
-- verifico se e' grande quasi come il foglio
|
||||
if OutlineBox:getDimX() > Material.L_mm - 51 or OutlineBox:getDimY() > Material.W_mm - 26 then
|
||||
BigPartsQty = BigPartsQty + 1
|
||||
end
|
||||
-- copio outline in un layer dedicato
|
||||
local OutlineLayer = EgtGroup(PartId1)
|
||||
EgtSetName(OutlineLayer, OUTLINE)
|
||||
@@ -894,8 +886,6 @@ local function AddPartListToNesting(PartList, ErrorList, Material)
|
||||
end
|
||||
EgtAutoNestAddToolOutlineToPart( PartId1, nSkeletonRegionId)
|
||||
end
|
||||
--EgtSaveFile("c:\\Temp\\TestSauderBig.nge")
|
||||
return BigPartsQty
|
||||
end
|
||||
--
|
||||
|
||||
@@ -1060,8 +1050,7 @@ function NestingLib.NestPartInRawPart(LastRaw, PartList, Material, ErrorList, Is
|
||||
EgtResetCurrMachGroup()
|
||||
|
||||
-- aggiungo tutti i pezzi al nesting
|
||||
local BigPartsQty = 0
|
||||
BigPartsQty = AddPartListToNesting(PartList, ErrorList, Material) or 0
|
||||
AddPartListToNesting(PartList, ErrorList, Material)
|
||||
|
||||
-- ripristino MachGroup
|
||||
EgtSetCurrMachGroup(nOldMachGroup)
|
||||
@@ -1083,19 +1072,6 @@ function NestingLib.NestPartInRawPart(LastRaw, PartList, Material, ErrorList, Is
|
||||
end
|
||||
end
|
||||
|
||||
-- se ci sono pezzi grandi
|
||||
-- if BigPartsQty > 0 then
|
||||
-- -- creo un ugual numero di fogli senza etichetta
|
||||
-- local BigSheetPartId = EgtGroup(GDB_ID.ROOT)
|
||||
-- EgtSetName(BigSheetPartId, "Sheet")
|
||||
-- local BigSheetLayerId = EgtGroup(BigSheetPartId)
|
||||
-- EgtSetName(BigSheetLayerId, OUTLINE)
|
||||
-- local BigSheetOutlineId = EgtRectangle2P(BigSheetLayerId, Point3d(0,0,0), Point3d(Material.L_mm, Material.W_mm, 0), GDB_RT.GLOB)
|
||||
-- EgtModifyCurveThickness(BigSheetOutlineId, -Material.T_mm)
|
||||
-- EgtSetName(BigSheetOutlineId, OUTLINE)
|
||||
-- EgtAutoNestAddSheet( BigSheetPartId, BigSheetOutlineId, dKerf, 0, BigPartsQty) -- EgtAutoNestAddSheet( SheetId, OutlineId, dKerf, nPriority, nCount)
|
||||
-- end
|
||||
|
||||
-- verifico se ultimo grezzo non nullo
|
||||
local LastMachGroupId = nil
|
||||
if LastRaw and LastRaw ~= GDB_ID.NULL then
|
||||
@@ -1125,18 +1101,6 @@ function NestingLib.NestPartInRawPart(LastRaw, PartList, Material, ErrorList, Is
|
||||
-- la aggiungo come difetto
|
||||
EgtAutoNestAddDefectToSheet(SheetPartId, nSheetLabel) -- EgtAutoNestAddDefectToSheet( SheetId, DefectId)
|
||||
else
|
||||
-- se ci sono pezzi grandi
|
||||
if BigPartsQty > 0 then
|
||||
-- -- creo un ugual numero di fogli senza etichetta
|
||||
-- local BigSheetPartId = EgtGroup(GDB_ID.ROOT)
|
||||
-- EgtSetName(BigSheetPartId, "Sheet")
|
||||
-- local BigSheetLayerId = EgtGroup(BigSheetPartId)
|
||||
-- EgtSetName(BigSheetLayerId, OUTLINE)
|
||||
-- local BigSheetOutlineId = EgtRectangle2P(BigSheetLayerId, Point3d(0,0,0), Point3d(Material.L_mm, Material.W_mm, 0), GDB_RT.GLOB)
|
||||
-- EgtModifyCurveThickness(BigSheetOutlineId, -Material.T_mm)
|
||||
-- EgtSetName(BigSheetOutlineId, OUTLINE)
|
||||
EgtAutoNestAddSheet( SheetPartId, SheetOutlineId, dKerf, 0, BigPartsQty) -- EgtAutoNestAddSheet( SheetId, OutlineId, dKerf, nPriority, nCount)
|
||||
end
|
||||
-- creo etichetta dello sheet
|
||||
local dLabelW = 50
|
||||
local dLabelH = 25
|
||||
@@ -1217,7 +1181,6 @@ function NestingLib.NestPartInRawPart(LastRaw, PartList, Material, ErrorList, Is
|
||||
else
|
||||
table.insert(ErrorList, {ErrType = "E.10", Uid = "Generic", Description = "Error in nesting function!"})
|
||||
end
|
||||
--EgtSaveFile("c://Temp//TestSauderBigParts.nge")
|
||||
-- ritorno l'ultimo grezzo utilizzato
|
||||
return LastRaw
|
||||
end
|
||||
@@ -2740,8 +2703,8 @@ 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(CountersinkMachining, 2, Config.NWCountersinkMachTools[1])
|
||||
table.insert(OutsideChamferMachining, 2, Config.MXOutsideChamferMachTools[1])
|
||||
table.insert(InsideChamferMachining, 2, Config.NWInsideChamferMachTools[1])
|
||||
Pocketing = Config.NWPocketingTools
|
||||
IsOffline = true
|
||||
|
||||
Reference in New Issue
Block a user