DataWall :
- correzioni per verifica setup prima di simulazione - aggiunto massimo affondamento di lama e fresa nella tavola - in Gorge larghezza come gambo più sicurezza e impostata rotazione asse C - nell'ordinamento si fanno le gole orizzontali (SideMill) prima di quelle inclinate - migliorati controlli forature in nesting.
This commit is contained in:
+115
-29
@@ -375,10 +375,12 @@ local function ComputeToolOutlines( nPartId)
|
||||
end
|
||||
|
||||
|
||||
local function ClassifyDrillsOnLateralFaces( nPartId)
|
||||
local function ClassifyDrillsOnLateralFaces( nPartId, dMinSheetWidth)
|
||||
|
||||
local dDeltaRaw = WD.MAX_WIDTH - dMinSheetWidth + NEST.KERF
|
||||
local DrillClassif
|
||||
local DrillOnFaces = { F = {nbr = 0, closed = false, long = false}, B = {nbr = 0, closed = false, long = false}, L = {nbr = 0, closed = false, long = false}, R = {nbr = 0, closed = false, long = false}}
|
||||
local DrillOnFaces = { F = {nbr = 0, closed = false, long = false, OnlyOnRef = false}, B = {nbr = 0, closed = false, long = false, OnlyOnRef = false},
|
||||
L = {nbr = 0, closed = false, long = false, OnlyOnRef = false}, R = {nbr = 0, closed = false, long = false, OnlyOnRef = false}}
|
||||
local nBoxLayerId = EgtGetFirstNameInGroup( nPartId, "Box")
|
||||
local nBoxId = EgtGetFirstNameInGroup( nBoxLayerId, "Box")
|
||||
local b3Part = EgtGetBBoxGlob(nBoxId, GDB_BB.STANDARD)
|
||||
@@ -398,15 +400,19 @@ local function ClassifyDrillsOnLateralFaces( nPartId)
|
||||
local ptDrill = EgtCP( AuxId, GDB_RT.GLOB)
|
||||
local dLen = abs( EgtCurveThickness( AuxId))
|
||||
local bLong = dLen > WD.HOR_DRILL_LEN - 1
|
||||
local bOnlyOnRef = dLen + dDeltaRaw > WD.HOR_DRILL_LEN - GEO.EPS_SMALL and not bLong
|
||||
|
||||
-- faccia Front
|
||||
local dTol = GEO.EPS_SMALL
|
||||
if ( abs( ptDrill:getY() - ptPartMin:getY()) < dTol) then
|
||||
DrillOnFaces.F.nbr = DrillOnFaces.F.nbr + 1
|
||||
DrillOnFaces.F.nbr = DrillOnFaces.F.nbr + 1
|
||||
if bOnlyOnRef then DrillOnFaces.F.OnlyOnRef = true end
|
||||
if bOpen then
|
||||
DrillOnFaces.B.nbr = DrillOnFaces.B.nbr + 1
|
||||
if bOnlyOnRef then DrillOnFaces.B.OnlyOnRef = true end
|
||||
else
|
||||
DrillOnFaces.F.closed = true
|
||||
DrillOnFaces.F.closed = true
|
||||
|
||||
end
|
||||
if bLong then
|
||||
DrillOnFaces.F.long = true
|
||||
@@ -415,11 +421,13 @@ local function ClassifyDrillsOnLateralFaces( nPartId)
|
||||
|
||||
-- faccia Back
|
||||
elseif ( abs( ptDrill:getY() - ptPartMax:getY()) < dTol) then
|
||||
DrillOnFaces.B.nbr = DrillOnFaces.B.nbr + 1
|
||||
DrillOnFaces.B.nbr = DrillOnFaces.B.nbr + 1
|
||||
if bOnlyOnRef then DrillOnFaces.B.OnlyOnRef = true end
|
||||
if bOpen then
|
||||
DrillOnFaces.F.nbr = DrillOnFaces.F.nbr + 1
|
||||
DrillOnFaces.F.nbr = DrillOnFaces.F.nbr + 1
|
||||
if bOnlyOnRef then DrillOnFaces.F.OnlyOnRef = true end
|
||||
else
|
||||
DrillOnFaces.B.closed = true
|
||||
DrillOnFaces.B.closed = true
|
||||
end
|
||||
if bLong then
|
||||
DrillOnFaces.B.long = true
|
||||
@@ -428,11 +436,13 @@ local function ClassifyDrillsOnLateralFaces( nPartId)
|
||||
|
||||
-- faccia Left
|
||||
elseif ( abs( ptDrill:getX() - ptPartMin:getX()) < dTol) then
|
||||
DrillOnFaces.L.nbr = DrillOnFaces.L.nbr + 1
|
||||
DrillOnFaces.L.nbr = DrillOnFaces.L.nbr + 1
|
||||
if bOnlyOnRef then DrillOnFaces.L.OnlyOnRef = true end
|
||||
if bOpen then
|
||||
DrillOnFaces.R.nbr = DrillOnFaces.R.nbr + 1
|
||||
DrillOnFaces.R.nbr = DrillOnFaces.R.nbr + 1
|
||||
if bOnlyOnRef then DrillOnFaces.R.OnlyOnRef = true end
|
||||
else
|
||||
DrillOnFaces.L.closed = true
|
||||
DrillOnFaces.L.closed = true
|
||||
end
|
||||
if bLong then
|
||||
DrillOnFaces.L.long = true
|
||||
@@ -442,10 +452,12 @@ local function ClassifyDrillsOnLateralFaces( nPartId)
|
||||
-- faccia Right
|
||||
elseif ( abs( ptDrill:getX() - ptPartMax:getX()) < dTol) then
|
||||
DrillOnFaces.R.nbr = DrillOnFaces.R.nbr + 1
|
||||
if bOnlyOnRef then DrillOnFaces.R.OnlyOnRef = true end
|
||||
if bOpen then
|
||||
DrillOnFaces.L.nbr = DrillOnFaces.L.nbr + 1
|
||||
DrillOnFaces.L.nbr = DrillOnFaces.L.nbr + 1
|
||||
if bOnlyOnRef then DrillOnFaces.L.OnlyOnRef = true end
|
||||
else
|
||||
DrillOnFaces.R.closed = true
|
||||
DrillOnFaces.R.closed = true
|
||||
end
|
||||
if bLong then
|
||||
DrillOnFaces.R.long = true
|
||||
@@ -460,20 +472,62 @@ local function ClassifyDrillsOnLateralFaces( nPartId)
|
||||
-- identifico la faccia da mettere sul lato del grezzo
|
||||
local sDrillFace, nMax = '', -100
|
||||
for k, v in pairs( DrillOnFaces) do
|
||||
if v.nbr > nMax then
|
||||
sDrillFace, nMax = k, v.nbr
|
||||
if v.nbr > nMax or ( v.nbr == nMax and not DrillOnFaces[sDrillFace].OnlyOnRef and v.OnlyOnRef) then
|
||||
sDrillFace, nMax = k, v.nbr
|
||||
end
|
||||
end
|
||||
|
||||
local sDrillFace2
|
||||
if nMax > 0 then
|
||||
if sDrillFace == 'F' or sDrillFace == 'B' then
|
||||
-- cerco chi vince tra faccia left e right
|
||||
if DrillOnFaces.L.nbr > DrillOnFaces.R.nbr then
|
||||
sDrillFace2 = 'L'
|
||||
elseif DrillOnFaces.L.nbr < DrillOnFaces.R.nbr then
|
||||
sDrillFace2 = 'R'
|
||||
elseif DrillOnFaces.L.nbr == DrillOnFaces.R.nbr and DrillOnFaces.L.nbr > 0 then
|
||||
if DrillOnFaces.L.OnlyOnRef then
|
||||
sDrillFace2 = 'L'
|
||||
else
|
||||
sDrillFace2 = 'R'
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
-- cerco chi vince tra faccia front e back
|
||||
if DrillOnFaces.F.nbr > DrillOnFaces.B.nbr then
|
||||
sDrillFace2 = 'F'
|
||||
elseif DrillOnFaces.F.nbr < DrillOnFaces.B.nbr then
|
||||
sDrillFace2 = 'B'
|
||||
elseif DrillOnFaces.F.nbr == DrillOnFaces.B.nbr and DrillOnFaces.F.nbr > 0 then
|
||||
if DrillOnFaces.F.OnlyOnRef then
|
||||
sDrillFace2 = 'F'
|
||||
else
|
||||
sDrillFace2 = 'B'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if NEST.DRILL_MACH_AREA == 0 then
|
||||
DrillOnFaces[sDrillFace].long = false
|
||||
end
|
||||
|
||||
if nMax > 0 then
|
||||
DrillClassif = { sCase = sDrillFace, bClosed = DrillOnFaces[sDrillFace].closed, bLong = DrillOnFaces[sDrillFace].long}
|
||||
DrillClassif = { sCase = sDrillFace, bClosed = DrillOnFaces[sDrillFace].closed, bLong = DrillOnFaces[sDrillFace].long, bOnlyOnRef = DrillOnFaces[sDrillFace].OnlyOnRef }
|
||||
end
|
||||
|
||||
local DrillClassif2
|
||||
if sDrillFace2 then
|
||||
if NEST.DRILL_MACH_AREA == 0 then
|
||||
DrillOnFaces[sDrillFace2].long = false
|
||||
end
|
||||
DrillClassif2 = { sCase = sDrillFace2, bClosed = DrillOnFaces[sDrillFace2].closed, bLong = DrillOnFaces[sDrillFace2].long, bOnlyOnRef = DrillOnFaces[sDrillFace2].OnlyOnRef }
|
||||
end
|
||||
|
||||
|
||||
return DrillClassif
|
||||
return DrillClassif, DrillClassif2
|
||||
end
|
||||
|
||||
local function ClassifyLapJointsFromBottom( nPartId)
|
||||
@@ -673,11 +727,12 @@ end
|
||||
|
||||
|
||||
-- Funzione che classifica i pezzi in base alla loro necessità di stare negli angoli
|
||||
local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot)
|
||||
local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot, dMinSheetWidth)
|
||||
|
||||
-- elimino eventuali info
|
||||
EgtSetInfo( nPartId, "NestOnEdge", 0)
|
||||
EgtSetInfo( nPartId, "NestOnAngle", 0)
|
||||
EgtSetInfo( nPartId, "OnlyOnRefSide", 0)
|
||||
|
||||
local nAngle
|
||||
local nRotate = 0
|
||||
@@ -686,15 +741,18 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot)
|
||||
local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.STANDARD)
|
||||
|
||||
-- fori
|
||||
local DrillClassif = ClassifyDrillsOnLateralFaces( nPartId)
|
||||
local DrillClassif, DrillClassif2 = ClassifyDrillsOnLateralFaces( nPartId, dMinSheetWidth)
|
||||
local bDrill = false
|
||||
local bDrillOpen = false
|
||||
local bLongDrill = false
|
||||
local bLongDrill = false
|
||||
|
||||
if DrillClassif then
|
||||
bDrill = true
|
||||
bDrillOpen = not DrillClassif.bClosed
|
||||
bLongDrill = DrillClassif.bLong
|
||||
if DrillClassif.bOnlyOnRef then
|
||||
EgtSetInfo( nPartId, "OnlyOnRefSide", 1)
|
||||
end
|
||||
end
|
||||
|
||||
-- oriento il pezzo in base al foro
|
||||
@@ -718,8 +776,20 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot)
|
||||
-- ritorno nella posizione originaria
|
||||
EgtRotate( nPartId, b3Part:getCenter(), Z_AX(), - RotationAngles[DrillClassif.sCase], GDB_RT.GLOB)
|
||||
nRotate = nRotate - RotationAngles[DrillClassif.sCase]
|
||||
-- dimentico di avere il foro
|
||||
bDrill = false
|
||||
-- se ho un'altra posizione possibile ruoto in quella
|
||||
if DrillClassif2 then
|
||||
EgtRotate( nPartId, b3Part:getCenter(), Z_AX(), RotationAngles[DrillClassif2.sCase], GDB_RT.GLOB)
|
||||
nRotate = nRotate + RotationAngles[DrillClassif2.sCase]
|
||||
bDrillOpen = not DrillClassif2.bClosed
|
||||
bLongDrill = DrillClassif2.bLong
|
||||
if DrillClassif2.bOnlyOnRef then
|
||||
EgtSetInfo( nPartId, "OnlyOnRefSide", 1)
|
||||
end
|
||||
else
|
||||
-- dimentico di avere il foro
|
||||
bDrill = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -962,8 +1032,9 @@ local function ComputeRestrictedZones( RawParts)
|
||||
end
|
||||
end
|
||||
|
||||
dMaxSheetWidth = -100
|
||||
nMaxSheet = 1
|
||||
local dMaxSheetWidth = -100
|
||||
local nMaxSheet = 1
|
||||
local dMinSheetWidth = WD.MAX_WIDTH
|
||||
for nInd = 1, #RawParts do
|
||||
local dSheetArea = RawParts[nInd].Len * RawParts[nInd].Width
|
||||
if RawParts[nInd].Width > dMaxSheetWidth + GEO.EPS_SMALL then
|
||||
@@ -974,6 +1045,9 @@ local function ComputeRestrictedZones( RawParts)
|
||||
nMaxSheet = nInd
|
||||
end
|
||||
end
|
||||
if RawParts[nInd].Width < dMinSheetWidth then
|
||||
dMinSheetWidth = RawParts[nInd].Width
|
||||
end
|
||||
|
||||
vSheetNbrEstimate[nInd] = min( ceil( dTotArea * vRawDistrib[nInd] / dSheetArea) + nSheetNbrCorrection, RawParts[nInd].Qty)
|
||||
if vSheetNbrEstimate[nInd] <= 0 then
|
||||
@@ -994,7 +1068,7 @@ local function ComputeRestrictedZones( RawParts)
|
||||
for nPartId, nCount in pairs( PART) do
|
||||
nPartIndex = nPartIndex + 1
|
||||
local bManualRot = EgtGetInfo( nPartId, "MANUALROT", 'b')
|
||||
local PartClassif = ClassifyAngles(tonumber(nPartId), RawParts[nMaxSheet], WD.ORIG_CORNER, bManualRot)
|
||||
local PartClassif = ClassifyAngles(tonumber(nPartId), RawParts[nMaxSheet], WD.ORIG_CORNER, bManualRot, dMinSheetWidth)
|
||||
if PartClassif then
|
||||
for nI = 1, nCount do
|
||||
local newTab = {PartId = PartClassif.PartId, Angle = PartClassif.Angle, nRotate = PartClassif.nRotate, bDrill = PartClassif.bDrill, bLongDrill = PartClassif.bLongDrill, bManual = PartClassif.bManual}
|
||||
@@ -1059,8 +1133,10 @@ local function ComputeRestrictedZones( RawParts)
|
||||
local bOnOppositeSide = false
|
||||
for nInd2 = 1, #vManuallyDone do
|
||||
-- verifico se il pezzo può stare sull'altro angolo
|
||||
local bCanBeOnOtherAngle = not AngleClassification[nInd].bDrill or
|
||||
( AngleClassification[nInd].bDrill and not AngleClassification[nInd].bLongDrill and RawParts[vManuallyDone[nInd2].RawPartId].Width >= WD.MINRAWY_HOR_DRILL)
|
||||
local bOnlyOnRef = EgtGetInfo( AngleClassification[nInd].PartId, "OnlyOnRefSide", 'b')
|
||||
local bCanBeOnOtherAngle = not bOnlyOnRef and
|
||||
( not AngleClassification[nInd].bDrill or
|
||||
( AngleClassification[nInd].bDrill and not AngleClassification[nInd].bLongDrill and RawParts[vManuallyDone[nInd2].RawPartId].Width >= WD.MINRAWY_HOR_DRILL))
|
||||
|
||||
if #(vManuallyDone[nInd2].Parts) == 0 then
|
||||
-- verifico che il pezzo stia in questo grezzo
|
||||
@@ -1079,7 +1155,8 @@ local function ComputeRestrictedZones( RawParts)
|
||||
if WD.ORIG_CORNER == 'BL' then sRefOrig = 'TL' end
|
||||
if WD.ORIG_CORNER == 'TR' then sRefOrig = 'BR' end
|
||||
if WD.ORIG_CORNER == 'BR' then sRefOrig = 'TR' end
|
||||
local res = ClassifyAngles( AngleClassification[nInd].PartId, RawParts[vManuallyDone[nInd2].RawPartId], sRefOrig)
|
||||
local bManTmp
|
||||
local res = ClassifyAngles( AngleClassification[nInd].PartId, RawParts[vManuallyDone[nInd2].RawPartId], sRefOrig, bManTmp, dMinSheetWidth)
|
||||
-- verifico sia compatibile con pezzo già inserito
|
||||
local b3OtherPart = EgtGetBBoxGlob( vManuallyDone[nInd2].Parts[1].Id, GDB_BB.STANDARD)
|
||||
local b3Part = EgtGetBBoxGlob( AngleClassification[nInd].PartId, GDB_BB.STANDARD)
|
||||
@@ -1599,7 +1676,16 @@ local function AddParts(RawParts, vPartsDoneManually)
|
||||
end
|
||||
|
||||
-- vincolo StripY
|
||||
EgtAutoNestSetStripYconstraintToPart( nPartId, ptRef, NEST.KERF + dval + dStripYCorr, dRawMaxWidth - 2 * ( NEST.KERF + dval))
|
||||
local bOnlyOnRefSide = EgtGetInfo( nPartId, "OnlyOnRefSide", 'b')
|
||||
if bOnlyOnRefSide then
|
||||
if WD.ORIG_CORNER == 'BL' or WD.ORIG_CORNER == 'BR' then
|
||||
EgtAutoNestSetStripYconstraintToPart( nPartId, ptRef, NEST.KERF + dval + dStripYCorr, 100000)
|
||||
else
|
||||
EgtAutoNestSetStripYconstraintToPart( nPartId, ptRef, - 1000, dRawMaxWidth + 1000 - ( NEST.KERF + dval - dStripYCorr))
|
||||
end
|
||||
else
|
||||
EgtAutoNestSetStripYconstraintToPart( nPartId, ptRef, NEST.KERF + dval + dStripYCorr, dRawMaxWidth - 2 * ( NEST.KERF + dval))
|
||||
end
|
||||
|
||||
-- se sull'angolo aggiungo anche vincolo StripX
|
||||
if bOnAngle then
|
||||
@@ -1855,7 +1941,7 @@ if bNestingOk then
|
||||
|
||||
local nPartFlip = EgtGetInfo( nId, "INVERTED", 'i')
|
||||
nPartFlip = EgtIf( nPartFlip == 180, 1, 0)
|
||||
local nTotFlip = nPartFlip ~ nFlag
|
||||
local nTotFlip = EgtIf( nPartFlip ~ nFlag, 180, 0)
|
||||
EgtSetInfo( nPartDuploId, "FLIP", nTotFlip)
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user