diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index b0203b0..78a2521 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -280,10 +280,11 @@ if bToProcess then table.insert( vBeam, { Id = nPartId, PosX = dPosX, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))}) end if #vBeam == 0 then - BEAM.ERR = 14 - BEAM.MSG = 'Error : no beams in the project' - WriteErrToLogFile( BEAM.ERR, BEAM.MSG) - return + --BEAM.ERR = 14 + --BEAM.MSG = 'Error : no beams in the project' + --WriteErrToLogFile( BEAM.ERR, BEAM.MSG) + --return + EgtOutLog( 'Travi non trovate', 1) else local sOut = '' for i = 1, #vBeam do @@ -309,9 +310,19 @@ if bToProcess then -- Se devo creare la barra if bCreateBar then - -- Ne verifico le dimensioni - local dRawW = vBeam[1].Box:getDimY() - local dRawH = vBeam[1].Box:getDimZ() + local dRawW + local dRawH + if #vBeam == 0 then + -- Recupero l'identificativo del gruppo di lavoro corrente + local nMGrpId = EgtGetCurrMachGroup() + -- Recupero le dimensioni della barra + dRawW = EgtGetInfo(nMGrpId, 'BARWIDTH', 'd') + dRawH = EgtGetInfo(nMGrpId, 'BARHEIGHT', 'd') + else + -- Ne verifico le dimensioni + dRawW = vBeam[1].Box:getDimY() + dRawH = vBeam[1].Box:getDimZ() + end local vBeamErr = {} for i = 2, #vBeam do local dDimW = vBeam[i].Box:getDimY() @@ -373,8 +384,11 @@ if bToProcess then -- Lunghezza della barra local dRawL = dBarLen + 0.1 -- Sovramateriale di testa - local dOvmHead = vBeam[1].PosX or 0 - + local dOvmHead = 0 + if #vBeam > 0 then + dOvmHead = vBeam[1].PosX or 0 + end + -- Sistemo le travi nel grezzo local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, BEAM.FLAG == 6) if not bPbOk then diff --git a/NestProcess.lua b/NestProcess.lua index 23a6a39..11f1684 100644 --- a/NestProcess.lua +++ b/NestProcess.lua @@ -188,20 +188,22 @@ while Raws.Count > 0 and PartsToFill( Parts) > 0 do EgtSetInfo(nMachGroup, "AUTONEST", 1) -- Disegno i pezzi local CurrX = Raws.StartGap + local nInfoIndex = 1 for i = 1, Res.DiffParts do local PartIndex = Res.Data[i].Id local PartId = Parts[PartIndex].Id - local dLen = Parts[PartIndex].Len + local dLen = Parts[PartIndex].Len for j = 1, Res.Data[i].Count do -- creo pezzo copia local nPartDuploId = EgtDuploNew(PartId) - EgtSetInfo(nMachGroup, "PART" .. i, nPartDuploId .. "," .. CurrX) + EgtSetInfo(nMachGroup, "PART" .. nInfoIndex, nPartDuploId .. "," .. CurrX) -- local PtId = EgtSurfFrRectangle( GDB_ID.CL, ptOrig + Vector3d( CurrX, 10, 0), ptOrig + Vector3d( CurrX + dLen, 190, 0)) -- EgtSetColor( PtId, Color3d( 256 - 4 * PartId, 16 * PartId, 8 * PartId, 40)) -- EgtExtractSurfFrChunkLoops( PtId, 0, EgtGetParent( PtId)) -- local sText = string.format( 'P%d (%.0f)', Res.Data[i].Id, Parts[Res.Data[i].Id].Len) -- EgtTextAdv( GDB_ID.CL, ptOrig + Vector3d( CurrX + 0.5 * dLen, 100,0), 0, sText, 'ModernPropS.Nfe', 100, 'S', 60, 0.8, 0, GDB_TI.MC) CurrX = CurrX + dLen + Raws.MidGap + nInfoIndex = nInfoIndex + 1 end end @@ -227,6 +229,7 @@ while nMachGroup do EgtSetCurrMachGroup(nMachGroup) if EgtGetInfo(nMachGroup, "AUTONEST",'i') == 1 then EgtSetInfo(nMachGroup, "AUTONEST", "") + EgtSetInfo(nMachGroup, "UPDATEUI", 1) dofile(EgtGetSourceDir() .. "BatchProcessNew.lua") end nMachGroup = EgtGetNextMachGroup(nMachGroup)