-- necessary to find socket.core and mime.core package.cpath = package.cpath .. ";/EgtProg/LuaLibs/?.dll" require( 'EgtBase') _ENV = EgtProtectGlobal() EgtEnableDebug( true) local AREA = "Area" local BasePath = "c:/Users/Dell/Dropbox/SVG" local BatchDateId = "/2021/6/629" local MaxMatId = 25 for MatId = 1, MaxMatId do -- apro file if EgtOpenFile(BasePath .. "/Nesting" .. BatchDateId .. "/" .. MatId .. ".nge") then -- vado su gruppi di lavorazione local nSheetGroupId = EgtGetFirstMachGroup() while nSheetGroupId do local sGroupName = EgtGetMachGroupName(nSheetGroupId) local bOk = EgtSetCurrMachGroup(nSheetGroupId) local nOp = EgtGetFirstOperation() -- while nOp and false do -- if EgtGetOperationType(nOp) == MCH_OY.MILLING then -- local bOk = EgtSetCurrMachining(nOp) -- local nOut = EgtGetMachiningGeometry() -- local nPart = EgtGetParent(EgtGetParent(nOut[1][1])) -- local dArea = EgtGetInfo(nPart, AREA, 'd') -- -- --local b3Part = EgtGetBBox(nPart, 13) -- -- if EgtGetMachiningParam(MCH_MP.USERNOTES) == 'Outline = 1' then -- and (b3Part:getX() < 18 * GEO.ONE_INCH or b3Part:getY() < 18 * GEO.ONE_INCH) then -- EgtSetMachiningParam(MCH_MP.INVERT, true) -- if dArea and dArea < 11652 then -- EgtSetMachiningParam(MCH_MP.LEAVETAB, true) -- EgtSetMachiningParam(MCH_MP.TABMIN, 2) -- EgtSetMachiningParam(MCH_MP.TABMAX, 4) -- EgtSetMachiningParam(MCH_MP.TABDIST, 60) -- elseif dArea and dArea < 36500 then -- EgtSetMachiningParam(MCH_MP.LEAVETAB, true) -- EgtSetMachiningParam(MCH_MP.TABMIN, 4) -- EgtSetMachiningParam(MCH_MP.TABMAX, 6) -- EgtSetMachiningParam(MCH_MP.TABDIST, 200) -- else -- EgtSetMachiningParam(MCH_MP.TABDIST, 50000) -- end ---- else ---- EgtSetMachiningParam(MCH_MP.DEPTH_STR, "TH+0.1") -- end -- end -- nOp = EgtGetNextOperation(nOp) -- end -- local nRawPart = EgtGetFirstRawPart() -- local nPart = EgtGetFirstPartInRawPart(nRawPart) -- while nPart do -- -- nPart = EgtGetNextPartInRawPart(nPart) -- end EgtApplyAllMachinings() EgtApplyAllMachinings() -- genero local sCncPath = BasePath .. "/CNC" .. BatchDateId .. "/" .. MatId .."/" .. EgtGetMachGroupName(nSheetGroupId) .. ".cnc" local sPrintPath = BasePath .. "/CNC" .. BatchDateId .. "/" .. MatId .."/" .. EgtGetMachGroupName(nSheetGroupId) .. "_2.cnc" local sNewPrintPath = BasePath .. "/CNC_PRINT" .. BatchDateId .. "/" .. MatId .."/" .. EgtGetMachGroupName(nSheetGroupId) .. ".cnc" bOk = EgtGenerate(sCncPath) -- sposto file di stampa bOk = EgtCopyFile(sPrintPath, sNewPrintPath) bOk = EgtEraseFile(sPrintPath) nSheetGroupId = EgtGetNextMachGroup(nSheetGroupId) end EgtSaveFile() end end