DataWall :
- correzioni e migliorie varie.
This commit is contained in:
@@ -93,7 +93,7 @@ function WPF.FlipClassify( Proc, b3Raw)
|
||||
-- verifico se è lavorabile da sopra
|
||||
nFlip0 = EgtIf( dVtNZ < -0.5, 0, 100)
|
||||
-- verifico se e' lavorabile da fliped: cambio segno al versore
|
||||
nFlip1 = EgtIf( -dVtNZ < -0.5, 100, 0)
|
||||
nFlip1 = EgtIf( -dVtNZ < -0.5, 0, 100)
|
||||
|
||||
-- se altrimenti profilo orizzontale
|
||||
elseif abs( dVtNZ) < WD.NZ_MINA then
|
||||
|
||||
@@ -1563,7 +1563,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d
|
||||
end
|
||||
end
|
||||
end
|
||||
if not bEnablePreMill then
|
||||
if not bEnablePreMill and not bAsEnablePreMill then
|
||||
dExtraLongIni = 0
|
||||
dExtraLongEnd = 0
|
||||
end
|
||||
|
||||
+63
-23
@@ -7,7 +7,7 @@ _ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( false)
|
||||
|
||||
-- NFAR.PARTID =
|
||||
|
||||
NFAR.RAW_GRAIN_DIR_X = true
|
||||
|
||||
local sLog = 'Flip And Rotate Part ' .. tostring( NFAR.PARTID)
|
||||
EgtOutLog( sLog)
|
||||
@@ -149,7 +149,6 @@ local function ClassifyRotation( vPartProc)
|
||||
return RotateFeatureStates
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
|
||||
local vPartProc = WE.CollectFeatures( NFAR.PARTID)
|
||||
@@ -275,7 +274,33 @@ for nInd = 1, #vPartProc do
|
||||
end
|
||||
|
||||
|
||||
-- ROTATION
|
||||
-- ROTATION
|
||||
nRotate = 0
|
||||
-- venatura
|
||||
EgtRemoveInfo( NFAR.PARTID, "HasGrainDirection")
|
||||
local bGrain = false
|
||||
local sGrainInfo = EgtGetInfo( NFAR.PARTID, "GRAINDIRECTION", 's')
|
||||
if sGrainInfo then
|
||||
local sGrainAlign = string.sub( sGrainInfo, 7)
|
||||
local sGrainDir = string.sub( sGrainInfo, 1, 5)
|
||||
if sGrainAlign == "1" and ( sGrainDir == "1,0,0" or sGrainDir == "0,1,0") then
|
||||
EgtSetInfo( NFAR.PARTID, "HasGrainDirection", 1)
|
||||
bGrain = true
|
||||
-- trovo la rotazione ( a meno di 180°) che deve avere il pezzo per essere allineato con la venatura del grezzo
|
||||
local nGrainRot = 0
|
||||
if ( sGrainDir == "1,0,0" and not NFAR.RAW_GRAIN_DIR_X) or ( sGrainDir == "0,1,0" and NFAR.RAW_GRAIN_DIR_X) then
|
||||
nGrainRot = 90
|
||||
end
|
||||
|
||||
local nPartRot = EgtGetInfo( NFAR.PARTID, "ROTATED", 'i') or 0
|
||||
if ( nGrainRot == 0 and ( nPartRot == 90 or nPartRot == 270)) or ( nGrainRot == 90 and ( nPartRot == 0 or nPartRot == 180)) then
|
||||
local b3Part = EgtGetBBoxGlob( NFAR.PARTID, GDB_BB.STANDARD)
|
||||
EgtRotate( NFAR.PARTID, b3Part:getCenter(), Z_AX(), 90, GDB_RT.GLOB)
|
||||
nRotate = 90
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not bManualRot then
|
||||
|
||||
local RotateFeatureStates = ClassifyRotation( vPartProc)
|
||||
@@ -322,6 +347,7 @@ if not bManualRot then
|
||||
{ Rot = 90, Score = nRot90Min, ScoreCnt = nRot90Cnt},
|
||||
{ Rot = 180, Score = nRot180Min, ScoreCnt = nRot180Cnt},
|
||||
{ Rot = 270, Score = nRot270Min, ScoreCnt = nRot270Cnt}}
|
||||
local nRotateOpt = 0
|
||||
if #RotateFeatureStates > 0 then
|
||||
-- calcolo lato con punteggio minore o molteplicita' piu' alta
|
||||
local nRotMax = 0
|
||||
@@ -340,11 +366,10 @@ if not bManualRot then
|
||||
end
|
||||
end
|
||||
end
|
||||
nRotate = nRotMax
|
||||
nRotateOpt = nRotMax
|
||||
else
|
||||
nRotate = 0
|
||||
end
|
||||
|
||||
nRotateOpt = 0
|
||||
end
|
||||
|
||||
local bRotNest = false
|
||||
local nStepRotNest = 0
|
||||
@@ -354,7 +379,7 @@ if not bManualRot then
|
||||
if MinList[1].Score >= 50 and MinList[2].Score >= 50 and MinList[3].Score >= 50 and MinList[4].Score >= 50 then
|
||||
bRotNest = true
|
||||
nStepRotNest = 90
|
||||
elseif (nRotate == 0 and MinList[3].Score >= 50) or ( nRotate == 90 and MinList[4].Score >= 50) then
|
||||
elseif (nRotateOpt == 0 and MinList[3].Score >= 50) or ( nRotateOpt == 90 and MinList[4].Score >= 50) then
|
||||
bRotNest = true
|
||||
nStepRotNest = 180
|
||||
end
|
||||
@@ -362,25 +387,40 @@ if not bManualRot then
|
||||
-- altrimenti permetto tutto
|
||||
bRotNest = true
|
||||
nStepRotNest = 90
|
||||
end
|
||||
end
|
||||
|
||||
-- eseguo rotazione
|
||||
EgtRotate( NFAR.PARTID, b3Part:getCenter(), Z_AX(), nRotate, GDB_RT.GLOB)
|
||||
-- verifico se ci sono fori lungo Y che bloccano la rotazione
|
||||
local bDrillOnY = ( nStepRotNest == 180)
|
||||
-- verifico se ci sono fori lungo Y che bloccano la rotazione
|
||||
local bDrillOnY = ( nStepRotNest == 180)
|
||||
|
||||
-- verifico se rotazione è valida ( pezzo contenuto nel grezzo)
|
||||
b3Part = EgtGetBBoxGlob( NFAR.PARTID, GDB_BB.STANDARD)
|
||||
local bValidRotationForRaw = b3Part:getDimX() < WD.MAX_LENGTH and b3Part:getDimY() < WD.MAX_WIDTH
|
||||
local bRotatedIsValid = b3Part:getDimY() < WD.MAX_LENGTH and b3Part:getDimX() < WD.MAX_WIDTH
|
||||
if not bValidRotationForRaw and bRotatedIsValid then
|
||||
EgtRotate( NFAR.PARTID, b3Part:getCenter(), Z_AX(), 90, GDB_RT.GLOB)
|
||||
nRotate = nRotate + 90
|
||||
local b3Part = EgtGetBBoxGlob( NFAR.PARTID, GDB_BB.STANDARD)
|
||||
|
||||
if bGrain then
|
||||
-- se venatura eseguo rotazione solo se è di 180°
|
||||
if nRotateOpt == 180 then
|
||||
EgtRotate( NFAR.PARTID, b3Part:getCenter(), Z_AX(), nRotateOpt, GDB_RT.GLOB)
|
||||
nRotate = nRotate + nRotateOpt
|
||||
end
|
||||
nStepRotNest = 180
|
||||
else
|
||||
-- eseguo rotazione
|
||||
EgtRotate( NFAR.PARTID, b3Part:getCenter(), Z_AX(), nRotateOpt, GDB_RT.GLOB)
|
||||
nRotate = nRotate + nRotateOpt
|
||||
end
|
||||
|
||||
-- se non ci sono fori verifico se il pezzo cade
|
||||
if not bDrillOnY then
|
||||
|
||||
-- verifico se rotazione è valida ( pezzo contenuto nel grezzo) solo se no venatura
|
||||
if not bGrain then
|
||||
b3Part = EgtGetBBoxGlob( NFAR.PARTID, GDB_BB.STANDARD)
|
||||
local bValidRotationForRaw = b3Part:getDimX() < WD.MAX_LENGTH and b3Part:getDimY() < WD.MAX_WIDTH
|
||||
local bRotatedIsValid = b3Part:getDimY() < WD.MAX_LENGTH and b3Part:getDimX() < WD.MAX_WIDTH
|
||||
if not bValidRotationForRaw and bRotatedIsValid then
|
||||
EgtRotate( NFAR.PARTID, b3Part:getCenter(), Z_AX(), 90, GDB_RT.GLOB)
|
||||
nRotate = nRotate + 90
|
||||
nStepRotNest = 180
|
||||
end
|
||||
end
|
||||
|
||||
-- se no venatura e non ci sono fori verifico se il pezzo cade
|
||||
if not bGrain and not bDrillOnY then
|
||||
b3Part = EgtGetBBoxGlob( NFAR.PARTID, GDB_BB.STANDARD)
|
||||
local bValidRotation = b3Part:getDimX() > ( WD.INTRULLI or 1200)
|
||||
-- verifico se ruotata resta valida
|
||||
|
||||
+101
-79
@@ -147,7 +147,7 @@ local function IdentifyLJFromBottom( Proc, bCompute, nOutlineGrp)
|
||||
|
||||
local bLJFromBottom = false
|
||||
local nRectId
|
||||
local vtFace = {}
|
||||
local vtFace
|
||||
|
||||
local dMinCompZ = 0.95
|
||||
if Proc.Fct == 2 then
|
||||
@@ -157,13 +157,13 @@ local function IdentifyLJFromBottom( Proc, bCompute, nOutlineGrp)
|
||||
|
||||
-- se rivolto verso il basso
|
||||
if ( vtN[1]:getZ() < - dMinCompZ or vtN[2]:getZ() < - dMinCompZ) then
|
||||
vtFace[1] = EgtIf( vtN[1]:getZ() < - dMinCompZ, vtN[2], vtN[1])
|
||||
if not ( vtFace[1]:getZ() > dMinCompZ or vtFace[1]:getZ() < - dMinCompZ) then
|
||||
vtFace = EgtIf( vtN[1]:getZ() < - dMinCompZ, vtN[2], vtN[1])
|
||||
if not ( vtFace:getZ() > dMinCompZ or vtFace:getZ() < - dMinCompZ) then
|
||||
bLJFromBottom = true
|
||||
if bCompute then
|
||||
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
|
||||
-- creo il rettangolo della lavorazione
|
||||
nRectId = CreateToolRectangle( ptP1, WD.SIDEMILL_DIAM_DOWN / 2, ptP2, WD.SIDEMILL_DIAM_DOWN / 2, vtFace[1], WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
nRectId = CreateToolRectangle( ptP1, WD.SIDEMILL_DIAM_DOWN / 2, ptP2, WD.SIDEMILL_DIAM_DOWN / 2, vtFace, WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -175,14 +175,14 @@ local function IdentifyLJFromBottom( Proc, bCompute, nOutlineGrp)
|
||||
-- se nel mezzo di una faccia
|
||||
if not nFacInd2 then
|
||||
if nFacInd ~= -2 and nFacInd ~= GDB_ID.NULL then
|
||||
vtFace[1] = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
if not ( vtFace[1]:getZ() > dMinCompZ or vtFace[1]:getZ() < - dMinCompZ) then
|
||||
vtFace = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
if not ( vtFace:getZ() > dMinCompZ or vtFace:getZ() < - dMinCompZ) then
|
||||
local nOtherFace = EgtIf( nFacInd == 0, 1, 0)
|
||||
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nOtherFace, GDB_ID.ROOT)
|
||||
if abs( ptP1:getZ() - ptP2:getZ()) < GEO.EPS_SMALL then
|
||||
bLJFromBottom = true
|
||||
if bCompute then
|
||||
nRectId = CreateToolRectangle( ptP1, WD.SIDEMILL_DIAM_DOWN / 2, ptP2, WD.SIDEMILL_DIAM_DOWN / 2, vtFace[1], WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
nRectId = CreateToolRectangle( ptP1, WD.SIDEMILL_DIAM_DOWN / 2, ptP2, WD.SIDEMILL_DIAM_DOWN / 2, vtFace, WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -201,8 +201,8 @@ local function IdentifyLJFromBottom( Proc, bCompute, nOutlineGrp)
|
||||
if nFaceZ ~= -1 then
|
||||
local nFace = EgtIf( nFaceZ == nFacInd, nFacInd2, nFacInd)
|
||||
local nOtherFace = EgtIf( nFaceZ + nFace == 3, 0, EgtIf( nFaceZ + nFace == 2, 1, 2))
|
||||
vtFace[1] = EgtSurfTmFacetNormVersor( Proc.Id, nFace, GDB_ID.ROOT)
|
||||
vtFace[2] = EgtSurfTmFacetNormVersor( Proc.Id, nOtherFace, GDB_ID.ROOT)
|
||||
vtFace = EgtSurfTmFacetNormVersor( Proc.Id, nFace, GDB_ID.ROOT)
|
||||
--vtFace[2] = EgtSurfTmFacetNormVersor( Proc.Id, nOtherFace, GDB_ID.ROOT)
|
||||
bLJFromBottom = true
|
||||
if bCompute then
|
||||
local bAdj, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFace, nFaceZ, GDB_ID.ROOT)
|
||||
@@ -211,7 +211,7 @@ local function IdentifyLJFromBottom( Proc, bCompute, nOutlineGrp)
|
||||
ptP1, ptP2 = ptP2, ptP1
|
||||
end
|
||||
local dVal = EgtIf( NEST.MACH_AREA_IGNORE_3rdFACE == 1, WD.SIDEMILL_DIAM_DOWN / 2, 0)
|
||||
nRectId = CreateToolRectangle( ptP1, dVal, ptP2, WD.SIDEMILL_DIAM_DOWN / 2, vtFace[1], WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
nRectId = CreateToolRectangle( ptP1, dVal, ptP2, WD.SIDEMILL_DIAM_DOWN / 2, vtFace, WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -219,9 +219,9 @@ local function IdentifyLJFromBottom( Proc, bCompute, nOutlineGrp)
|
||||
elseif Proc.Fct == 4 then
|
||||
local nFacInd, dElev, nFacInd2, dElev2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
|
||||
if nFacInd ~= -2 and nFacInd ~= GDB_ID.NULL then
|
||||
vtFace[1] = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
vtFace = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
|
||||
if not ( vtFace[1]:getZ() > dMinCompZ or vtFace[1]:getZ() < - dMinCompZ) then
|
||||
if not ( vtFace:getZ() > dMinCompZ or vtFace:getZ() < - dMinCompZ) then
|
||||
local nOtherFace = -1
|
||||
for nIdx = 0, 3 do
|
||||
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nIdx, GDB_ID.ROOT)
|
||||
@@ -238,19 +238,19 @@ local function IdentifyLJFromBottom( Proc, bCompute, nOutlineGrp)
|
||||
if AreSamePointApprox( ptP2, ptP3) or AreSamePointApprox( ptP2, ptP4) then
|
||||
ptP1, ptP2 = ptP2, ptP1
|
||||
end
|
||||
nRectId = CreateToolRectangle( ptP1, 0, ptP2, WD.SIDEMILL_DIAM_DOWN / 2, vtFace[1], WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
nRectId = CreateToolRectangle( ptP1, 0, ptP2, WD.SIDEMILL_DIAM_DOWN / 2, vtFace, WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nFacInd2 and nFacInd2 ~= GDB_ID.NULL then
|
||||
local vtFace2 = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd2, GDB_ID.ROOT)
|
||||
if ( vtFace2:getZ() < - dMinCompZ or vtFace[1]:getZ() < - dMinCompZ) then
|
||||
if ( vtFace2:getZ() < - dMinCompZ or vtFace:getZ() < - dMinCompZ) then
|
||||
bLJFromBottom = true
|
||||
if vtFace[1]:getZ() < -dMinCompZ then vtFace[1] = vtFace2 end
|
||||
if vtFace:getZ() < -dMinCompZ then vtFace = vtFace2 end
|
||||
if bCompute then
|
||||
local bAdj, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nFacInd2, GDB_ID.ROOT)
|
||||
nRectId = CreateToolRectangle( ptP1, 0, ptP2, 0, vtFace[1], WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
nRectId = CreateToolRectangle( ptP1, 0, ptP2, 0, vtFace, WD.SIDEMILL_DIAM_DOWN, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -336,8 +336,8 @@ local function IdentifyLJFromTop( Proc, bCompute, nOutlineGrp)
|
||||
local nFace = EgtIf( nFaceZ == nFacInd, nFacInd2, nFacInd)
|
||||
local nOtherFace = EgtIf( nFaceZ + nFace == 3, 0, EgtIf( nFaceZ + nFace == 2, 1, 2))
|
||||
local vtFace = {}
|
||||
vtFace[1] = EgtSurfTmFacetNormVersor( Proc.Id, nFace, GDB_ID.ROOT)
|
||||
vtFace[2] = EgtSurfTmFacetNormVersor( Proc.Id, nOtherFace, GDB_ID.ROOT)
|
||||
vtFace = EgtSurfTmFacetNormVersor( Proc.Id, nFace, GDB_ID.ROOT)
|
||||
--vtFace = EgtSurfTmFacetNormVersor( Proc.Id, nOtherFace, GDB_ID.ROOT)
|
||||
bLJFromTop = true
|
||||
if bCompute then
|
||||
local bAdj, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFace, nFaceZ, GDB_ID.ROOT)
|
||||
@@ -348,9 +348,9 @@ local function IdentifyLJFromTop( Proc, bCompute, nOutlineGrp)
|
||||
|
||||
local b3Face = EgtSurfTmGetFacetBBoxGlob( Proc.Id, nFaceZ, GDB_BB.STANDARD)
|
||||
local dDim = 0
|
||||
if vtFace[1]:getX() > dMinComp or vtFace[1]:getX() < - dMinComp then
|
||||
if vtFace:getX() > dMinComp or vtFace:getX() < - dMinComp then
|
||||
dDim = b3Face:getDimX()
|
||||
elseif vtFace[1]:getY() > dMinComp or vtFace[1]:getY() < - dMinComp then
|
||||
elseif vtFace:getY() > dMinComp or vtFace:getY() < - dMinComp then
|
||||
dDim = b3Face:getDimY()
|
||||
end
|
||||
local dValFace = max( dDim + WD.SIDEMILL_DIAM_UP / 2, WD.SIDEMILL_DIAM_UP)
|
||||
@@ -358,7 +358,7 @@ local function IdentifyLJFromTop( Proc, bCompute, nOutlineGrp)
|
||||
if NEST.MACH_AREA_USE_OTHER_DIAM == 1 then
|
||||
dVal = NEST.MACH_AREA_OTHER_DIAM / 2
|
||||
end
|
||||
nRectId = CreateToolRectangle( ptP1, 0, ptP2, dVal, vtFace[1], dValFace, nOutlineGrp)
|
||||
nRectId = CreateToolRectangle( ptP1, 0, ptP2, dVal, vtFace, dValFace, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -666,18 +666,16 @@ local function ClassifyLapJointsFromBottom( nPartId)
|
||||
if LapJoint.Identify( vPartProc[nInd]) then
|
||||
-- verifico se LJ da sotto
|
||||
local vtFace = IdentifyLJFromBottom( vPartProc[nInd], false)
|
||||
if vtFace then
|
||||
for nInd2 = 1, #vtFace do
|
||||
if vtFace[nInd2]:getX() > dMinComponentVal then
|
||||
vtLapJoints["R"] = 1
|
||||
elseif vtFace[nInd2]:getX() < - dMinComponentVal then
|
||||
vtLapJoints["L"] = 1
|
||||
elseif vtFace[nInd2]:getY() > dMinComponentVal then
|
||||
vtLapJoints["B"] = 1
|
||||
elseif vtFace[nInd2]:getY() < - dMinComponentVal then
|
||||
vtLapJoints["F"] = 1
|
||||
end
|
||||
end
|
||||
if vtFace then
|
||||
if vtFace:getX() > dMinComponentVal then
|
||||
vtLapJoints["R"] = 1
|
||||
elseif vtFace:getX() < - dMinComponentVal then
|
||||
vtLapJoints["L"] = 1
|
||||
elseif vtFace:getY() > dMinComponentVal then
|
||||
vtLapJoints["B"] = 1
|
||||
elseif vtFace:getY() < - dMinComponentVal then
|
||||
vtLapJoints["F"] = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -857,7 +855,8 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot, dMinSheet
|
||||
local nAngle
|
||||
local nRotate = 0
|
||||
local bOptimal
|
||||
local bManual = false
|
||||
local bManual = false
|
||||
local bOnly180Rot = EgtGetInfo( nPartId, "HasGrainDirection", 'b') or false
|
||||
local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.STANDARD)
|
||||
|
||||
-- fori
|
||||
@@ -882,41 +881,63 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot, dMinSheet
|
||||
RotationAngles = { F = 180, B = 0, L = 270, R = 90}
|
||||
else
|
||||
RotationAngles = { F = 0, B = 180, L = 90, R = 270}
|
||||
end
|
||||
EgtRotate( nPartId, b3Part:getCenter(), Z_AX(), RotationAngles[DrillClassif.sCase], GDB_RT.GLOB)
|
||||
nRotate = nRotate + RotationAngles[DrillClassif.sCase]
|
||||
|
||||
-- verifico se la rotazione è valida
|
||||
local nBoxLayerId = EgtGetFirstNameInGroup( nPartId, "Box")
|
||||
local nBoxId = EgtGetFirstNameInGroup( nBoxLayerId, "Box")
|
||||
local b3Part = EgtGetBBoxGlob(nBoxId, GDB_BB.STANDARD)
|
||||
-- b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.STANDARD)
|
||||
local bIsValidRotation = b3Part:getDimX() < RawPart.Len - 2 * NEST.KERF + GEO.EPS_SMALL and b3Part:getDimY() < RawPart.Width - 2 * NEST.KERF + GEO.EPS_SMALL
|
||||
if not bIsValidRotation then
|
||||
-- ritorno nella posizione originaria
|
||||
EgtRotate( nPartId, b3Part:getCenter(), Z_AX(), - RotationAngles[DrillClassif.sCase], GDB_RT.GLOB)
|
||||
nRotate = nRotate - RotationAngles[DrillClassif.sCase]
|
||||
-- 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
|
||||
|
||||
-- se rotazione è libera
|
||||
if not bOnly180Rot then
|
||||
EgtRotate( nPartId, b3Part:getCenter(), Z_AX(), RotationAngles[DrillClassif.sCase], GDB_RT.GLOB)
|
||||
nRotate = nRotate + RotationAngles[DrillClassif.sCase]
|
||||
|
||||
-- verifico se la rotazione è valida
|
||||
local nBoxLayerId = EgtGetFirstNameInGroup( nPartId, "Box")
|
||||
local nBoxId = EgtGetFirstNameInGroup( nBoxLayerId, "Box")
|
||||
local b3Part = EgtGetBBoxGlob(nBoxId, GDB_BB.STANDARD)
|
||||
-- b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.STANDARD)
|
||||
local bIsValidRotation = b3Part:getDimX() < RawPart.Len - 2 * NEST.KERF + GEO.EPS_SMALL and b3Part:getDimY() < RawPart.Width - 2 * NEST.KERF + GEO.EPS_SMALL
|
||||
if not bIsValidRotation then
|
||||
-- ritorno nella posizione originaria
|
||||
EgtRotate( nPartId, b3Part:getCenter(), Z_AX(), - RotationAngles[DrillClassif.sCase], GDB_RT.GLOB)
|
||||
nRotate = nRotate - RotationAngles[DrillClassif.sCase]
|
||||
-- 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
|
||||
|
||||
-- se posso ruotare solo di 180° per venatura
|
||||
else
|
||||
if RotationAngles[DrillClassif.sCase] == 0 or RotationAngles[DrillClassif.sCase] == 180 then
|
||||
EgtRotate( nPartId, b3Part:getCenter(), Z_AX(), RotationAngles[DrillClassif.sCase], GDB_RT.GLOB)
|
||||
nRotate = nRotate + RotationAngles[DrillClassif.sCase]
|
||||
else
|
||||
-- vedo se ho un'altra posizione possibile
|
||||
if DrillClassif2 and ( RotationAngles[DrillClassif2.sCase] == 0 or RotationAngles[DrillClassif2.sCase] == 180) 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
|
||||
end
|
||||
|
||||
-- se non ho fori scelgo una posizione che non faccia cadere il pezzo
|
||||
local bOnly180Rot = false
|
||||
if not bDrill and not bLockedRot then
|
||||
-- se non ho venature e fori scelgo una posizione che non faccia cadere il pezzo
|
||||
if not bDrill and not bOnly180Rot and not bLockedRot then
|
||||
b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.STANDARD)
|
||||
local bIsValid = b3Part:getDimX() > ( WD.INTRULLI or 1200)
|
||||
local bRotatedIsValid = b3Part:getDimY() > ( WD.INTRULLI or 1200)
|
||||
@@ -948,7 +969,9 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot, dMinSheet
|
||||
end
|
||||
|
||||
-- se anche fori oppure possibile solo rotazione di 180° per non far cadere il pezzo
|
||||
if bDrill or bOnly180Rot then
|
||||
if bDrill or bOnly180Rot then
|
||||
local bCanRotate = not bDrill or ( bDrill and bDrillOpen)
|
||||
|
||||
if ResLapJoints.Nbr == 0 then
|
||||
nAngle = 0
|
||||
if not bDrill then bAdd = false end
|
||||
@@ -959,20 +982,20 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot, dMinSheet
|
||||
nAngle = 20
|
||||
elseif (( sRefOrig == 'TL' or sRefOrig == 'TR') and ResLapJoints.sCase == 'F' ) or
|
||||
(( sRefOrig == 'BL' or sRefOrig == 'BR') and ResLapJoints.sCase == 'B' ) then
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bDrillOpen or bOnly180Rot, 20, 100)
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bCanRotate, 20, 100)
|
||||
nRotate = nRotate + nRotate2
|
||||
elseif ResLapJoints.sCase == 'R' then
|
||||
if bDrillOpen or bOnly180Rot then bManual = true end
|
||||
if bCanRotate then bManual = true end
|
||||
if sRefOrig == 'TL' or sRefOrig == 'BL'then
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bDrillOpen or bOnly180Rot, 40, 0)
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bCanRotate, 40, 0)
|
||||
nRotate = nRotate + nRotate2
|
||||
else
|
||||
nAngle = 40
|
||||
end
|
||||
elseif ResLapJoints.sCase == 'L' then
|
||||
if bDrillOpen or bOnly180Rot then bManual = true end
|
||||
if bCanRotate then bManual = true end
|
||||
if sRefOrig == 'TR' or sRefOrig == 'BR' then
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bDrillOpen or bOnly180Rot, 40, 0)
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bCanRotate, 40, 0)
|
||||
nRotate = nRotate + nRotate2
|
||||
else
|
||||
nAngle = 40
|
||||
@@ -991,7 +1014,7 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot, dMinSheet
|
||||
(( sRefOrig == 'BL' or sRefOrig == 'BR') and (ResLapJoints.sCase == 'FL' or ResLapJoints.sCase == 'FR')) then
|
||||
nAngle = 40
|
||||
else
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bDrillOpen or bOnly180Rot, 40, 100)
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bCanRotate, 40, 100)
|
||||
nRotate = nRotate + nRotate2
|
||||
end
|
||||
end
|
||||
@@ -1002,19 +1025,19 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot, dMinSheet
|
||||
nAngle = 80
|
||||
elseif (( sRefOrig == 'TL' or sRefOrig == 'TR') and ResLapJoints.sCase == 'B' ) or
|
||||
(( sRefOrig == 'BL' or sRefOrig == 'BR') and ResLapJoints.sCase == 'F' ) then
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bDrillOpen or bOnly180Rot, 80, 100)
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bCanRotate, 80, 100)
|
||||
nRotate = nRotate + nRotate2
|
||||
elseif ResLapJoints.sCase == 'R' then
|
||||
if bDrillOpen or bOnly180Rot then bManual = true end
|
||||
if bCanRotate then bManual = true end
|
||||
if sRefOrig == 'TR' or sRefOrig == 'BR' then
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bDrillOpen or bOnly180Rot, 100, 100)
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bCanRotate, 100, 100)
|
||||
nRotate = nRotate + nRotate2
|
||||
end
|
||||
nAngle = 100
|
||||
elseif ResLapJoints.sCase == 'L' then
|
||||
if bDrillOpen or bOnly180Rot then bManual = true end
|
||||
if bCanRotate then bManual = true end
|
||||
if sRefOrig == 'TL' or sRefOrig == 'BL' then
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bDrillOpen or bOnly180Rot, 100, 100)
|
||||
nAngle, nRotate2 = RotateOptimalCaseDrill( nPartId, bCanRotate, 100, 100)
|
||||
nRotate = nRotate + nRotate2
|
||||
end
|
||||
nAngle = 100
|
||||
@@ -1120,8 +1143,7 @@ local function ClassifyAngles( nPartId, RawPart, sRefOrig, bLockedRot, dMinSheet
|
||||
if b3Part:getDimX() > ( WD.INTRULLI or 1200) then
|
||||
EgtSetInfo( nPartId, "REDUCECUT", 1)
|
||||
end
|
||||
|
||||
|
||||
|
||||
return PartAngleClassification
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user