diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 6566398..1fa2b9e 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -301,12 +301,16 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) end Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD) if b3Raw then + local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) -- recupero l'elenco delle facce della parte interessate dalla feature Proc.AffectedFaces = BL.GetProcessAffectedFaces( Proc) -- recupero informazioni sulle facce della feature Proc.Face = {} for i = 1, Proc.Fct do - Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT ), Elevation = BL.GetFaceElevation( Proc.Id, i - 1, PartId)} + Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT )} + if Proc.Fct < 10 then + Proc.Face[i].Elevation = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, GDB_ID.ROOT) + end end end if Proc.Box and not Proc.Box:isEmpty() then diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index adb85e0..f641fe2 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -439,57 +439,6 @@ function BeamLib.GetBoxFaceNorm( b3Box, ptP, vtV) end end ---------------------------------------------------------------------- -function BeamLib.GetFaceElevation( nSurfId, nFac, nPartId) - -- centro e normale della faccia - local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFac, GDB_ID.ROOT) - if not ptC or not vtN then return 0 end - -- riferimento OCS della faccia per ricavare elevazione rispetto alla faccia della superficie - local frOCS = Frame3d( ptC, vtN) - local b3Box = EgtGetBBoxRef( nSurfId, GDB_BB.STANDARD, frOCS) - local dElev = b3Box:getMax():getZ() - -- se definito identificativo di pezzo - if nPartId then - -- se superficie con più facce - if EgtSurfTmFacetCount( nSurfId) > 1 then - -- determino elevazione del centro faccia rispetto al box del pezzo - local _, dCenElev = BeamLib.GetPointDirDepth( nPartId, ptC, vtN) - if dCenElev and dCenElev > dElev then - dElev = dCenElev - end - -- altrimenti superficie ad una sola faccia - else - -- determino elevazione box del pezzo rispetto alla faccia - local b3Solid = EgtGetBBoxRef( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD, frOCS) - local dSolidElev = b3Solid:getMax():getZ() - if b3Solid and dSolidElev > dElev then - dElev = dSolidElev - end - end - end - return dElev -end - ---------------------------------------------------------------------- -function BeamLib.GetOtherFaceElevation( nSurfId, nOtherSurfId, nOtherFac, nPartId) - -- centro e normale della faccia - local ptC, vtN = EgtSurfTmFacetCenter( nOtherSurfId, nOtherFac, GDB_ID.ROOT) - if not ptC or not vtN then return 0 end - -- riferimento OCS della faccia per ricavare elevazione rispetto alla faccia della superficie - local frOCS = Frame3d( ptC, vtN) - local b3Box = EgtGetBBoxRef( nSurfId, GDB_BB.STANDARD, frOCS) - local dElev = b3Box:getMax():getZ() - -- se definito identificativo di pezzo - if nPartId then - -- determino elevazione del centro faccia rispetto al box del pezzo - local _, dCenElev = BeamLib.GetPointDirDepth( nPartId, ptC, vtN) - if dCenElev and dCenElev > dElev then - dElev = dCenElev - end - end - return dElev -end - --------------------------------------------------------------------- function BeamLib.GetFaceElevationFromPointDir( nSurfId, nPartId, ptC, vtN, nIdGeomMaster) if not ptC or not vtN then return 0 end @@ -515,6 +464,7 @@ end --------------------------------------------------------------------- function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng) local nSurfId = Proc.Id + local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) -- verifica che la superficie non sia chiusa e quindi non lavorabile if EgtSurfIsClosed( nSurfId) then return @@ -645,7 +595,7 @@ function BeamLib.GetFaceWithMostAdj( Proc, nPartId, bCompare3Fc, dCosSideAng) local dMinElev, dMinElev2 = GEO.INFINITO, GEO.INFINITO local dtElev = {} for i = 1, #nFacInd do - local dElev = BeamLib.GetFaceElevation( nSurfId, nFacInd[i], nPartId) + local dElev = EgtSurfTmFacetElevationInBBox( nSurfId, nFacInd[i], b3Solid, GDB_ID.ROOT) table.insert( dtElev, dElev) if dElev < dMinElev then if dMinElev < dMinElev2 then diff --git a/LuaLibs/FaceByPocket.lua b/LuaLibs/FaceByPocket.lua index f4f389a..dd695d2 100644 --- a/LuaLibs/FaceByPocket.lua +++ b/LuaLibs/FaceByPocket.lua @@ -78,7 +78,7 @@ function FaceByPocket.Make( Proc, nSurfId, nFacet, sPocketing, nPartId, b3Solid, end -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT) - local dElev = BL.GetFaceElevation( nSurfId, nFacet, nPartId) + local dElev = EgtSurfTmFacetElevationInBBox( nSurfId, nFacet, b3Solid, GDB_ID.ROOT) -- determino numero e valore degli step di lavorazione local nSurfStep = ceil( dElev / dMaxDepth) local dSurfStep = dElev / nSurfStep diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 7d23c74..d230e3c 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1589,7 +1589,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, -- distanza di sicurezza per evitare collisioni dCollSic = BL.CalcCollisionSafety( vtN1) -- elevazione massima della faccia - dMaxElev = BL.GetFaceElevation( Proc.Id, nFacInd, nPartId) + dMaxElev = EgtSurfTmFacetElevationInBBox( Proc.Id, nFacInd, b3Solid, GDB_ID.ROOT) -- ciclo tutta la tabella local tPaths = {} local ptIniPath @@ -1634,7 +1634,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, -- distanza di sicurezza per evitare collisioni dCollSic = BL.CalcCollisionSafety( vtOrtho) -- calcolo elevazione dalla faccia trasversale aggiunta - local dSurfIntElev = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0) + local dSurfIntElev = EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT) if bDoubleSide then dMaxElev = dSurfIntElev else @@ -1645,13 +1645,13 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, -- se non è possibile svuotare completamente da una sola parte if dTMaxDepth <= ( dMaxElev + BD.CUT_EXTRA + dCollSic) then bDoubleSide = true - dMaxElev = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0) + dMaxElev = EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT) else - dExtraDepth = dMaxElev - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0) + dExtraDepth = dMaxElev - EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT) end -- altrimenti non è stata fatta completamente calcolo la distanza tra faccia aggiunta e profondità superficie else - dExtraDepth = dMaxElev - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0) + dExtraDepth = dMaxElev - EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT) end end -- normale alla faccia aggiunta @@ -4240,7 +4240,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, dCheckDepth = 0.5 * dDepth else if not nPathInt then - dCheckDepth = BL.GetFaceElevation( Proc.Id, nFacInd) + dCheckDepth = EgtSurfTmFacetElevationInBBox( Proc.Id, nFacInd, b3Solid, GDB_ID.ROOT) else dCheckDepth = dDepth end @@ -4289,7 +4289,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, end local ptIniPath local nMaxLen = 0 - dMaxElevMaster = BL.GetFaceElevation( Proc.Id, nFacInd) + dMaxElevMaster = EgtSurfTmFacetElevationInBBox( Proc.Id, nFacInd, b3Solid, GDB_ID.ROOT) -- ciclo tutta la tabella for i = 1, #tFacAdjMain do -- le 2 facce di contatto devono essere perpendicolari o non sottosquadra rispetto alla faccia di fondo @@ -4348,13 +4348,13 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, -- se non è possibile svuotare completamente da una sola parte if dMaxDepth <= ( dMaxElevMaster + BD.CUT_EXTRA + dCollSic) then bDoubleSide = true - dMaxElevMaster = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0) + dMaxElevMaster = EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT) else - dExtraDepth = dMaxElevMaster - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0) + dExtraDepth = dMaxElevMaster - EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT) end -- altrimenti non è stata fatta completamente calcolo la distanza tra faccia aggiunta e profondità superficie else - dExtraDepth = dMaxElevMaster - BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0) + dExtraDepth = dMaxElevMaster - EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT) end end vtN1 = Vector3d(vtOrtho) @@ -4897,7 +4897,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa return false, sErr end nFacInd = nFacAdj - dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd) + dFacElev = EgtSurfTmFacetElevationInBBox( Proc.Id, nFacInd, b3Solid, GDB_ID.ROOT) ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) end @@ -5159,7 +5159,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local tvtNx = {} tvtNx[2] = vtN local ptPs = ptC - dFacElev = BL.GetFaceElevation( Proc.Id, nFacInd) + dFacElev = EgtSurfTmFacetElevationInBBox( Proc.Id, nFacInd, b3Solid, GDB_ID.ROOT) dCollSic = BL.CalcCollisionSafety( tvtNx[2]) local dMachDepth = dFacElev + dCollSic local frFacRec, dFacDim1, dFacDim2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) @@ -5181,7 +5181,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end vAdj[i] = nCount if vAdj[i] == Proc.Fct - 1 and i ~= nFacInd + 1 then - dV = BL.GetFaceElevation( Proc.Id, i - 1) + dV = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, GDB_ID.ROOT) vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT) end end diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index 3571baf..4b66796 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -959,7 +959,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus if bForceUseBladeOnNotThruFace and ( bLimXmin or bLimXmax) then local nCountMilHead = 0 -- determino la massima elevazione - local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) + local dElev = EgtSurfTmFacetElevationInBBox( Proc.Id, 0, b3Solid, GDB_ID.ROOT) -- recupero la lavorazione local sMilling = ML.FindMilling( 'Long2Cut_H2', dElev, nil, nil, nil, not bCanUseUnderBlade, bCanUseUnderBlade) if not sMilling then @@ -1209,7 +1209,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus -- se non è sotto e non uso fresa di fianco: lavorazione Long2Cut elseif ( nSide ~= - 1 or BD.DOWN_HEAD) and nUseMillOnSide == 0 then -- determino la massima elevazione - local dElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) + local dElev = EgtSurfTmFacetElevationInBBox( Proc.Id, 0, b3Solid, GDB_ID.ROOT) -- recupero la lavorazione local bDownHead = ( nSide == - 1) sMchType = EgtIf( bDownHead, 'Long2Cut_H2', 'Long2Cut') @@ -1553,7 +1553,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus local dDistToEnd = dToolDiam / 2 local dDistToEndDn = dToolDiamDn / 2 -- calcolo l'elevazione della faccia principale - local dFacElev = BL.GetFaceElevation( Proc.Id, 0, nPartId) + local dFacElev = EgtSurfTmFacetElevationInBBox( Proc.Id, 0, b3Solid, GDB_ID.ROOT) -- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino all'estremo con l'elevazione della faccia minore del raggio utensile if ( nUseMillOnSide <= 1 or nSide == -1) and dFacElev < dToolDiam / 2 then dDistToEnd = sqrt( dFacElev * ( dToolDiam - dFacElev)) diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index 6303a1a..68e66d3 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -1450,8 +1450,8 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster local dDistToEnd = dToolDiam / 2 local dDistToEndDn = dToolDiamDn / 2 -- calcolo l'elevazione della faccia principale - local dFacElev1 = BL.GetFaceElevation( Proc.Id, tFaceLong[vOrd[1]], nPartId) - local dFacElev2 = BL.GetFaceElevation( Proc.Id, tFaceLong[vOrd[2]], nPartId) + local dFacElev1 = EgtSurfTmFacetElevationInBBox( Proc.Id, tFaceLong[vOrd[1]], b3Solid, GDB_ID.ROOT) + local dFacElev2 = EgtSurfTmFacetElevationInBBox( Proc.Id, tFaceLong[vOrd[2]], b3Solid, GDB_ID.ROOT) -- se fresa di fianco o da sotto calcolo quanto l'utensile può andare vicino al limite se l'elevazione della faccia è minore del raggio utensile if nUseMillOnSide <= 1 or nSide == -1 then local dFacElev = max( dFacElev1, dFacElev2) diff --git a/LuaLibs/ProcessProfCamb.lua b/LuaLibs/ProcessProfCamb.lua index a8f2e02..8df0a51 100644 --- a/LuaLibs/ProcessProfCamb.lua +++ b/LuaLibs/ProcessProfCamb.lua @@ -285,7 +285,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- aggiungo piano di sgrossatura e lo lavoro local ptStart, vtNP = GetSawCutData( AuxId, vtNF) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) - if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then + if AddId and EgtSurfTmFacetElevationInBBox( AddId, 0, b3Solid, GDB_ID.ROOT) > 20.0 then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura diff --git a/LuaLibs/ProcessProfConcave.lua b/LuaLibs/ProcessProfConcave.lua index 8de536a..ba49c7c 100644 --- a/LuaLibs/ProcessProfConcave.lua +++ b/LuaLibs/ProcessProfConcave.lua @@ -289,7 +289,7 @@ function ProcessProfConcave.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- aggiungo piano di sgrossatura e lo lavoro local ptStart, vtNP = GetSawCutData( AuxId, vtN) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) - if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then + if AddId and EgtSurfTmFacetElevationInBBox( AddId, 0, b3Solid, GDB_ID.ROOT) > 20.0 then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura diff --git a/LuaLibs/ProcessProfConvex.lua b/LuaLibs/ProcessProfConvex.lua index 9da2783..6faad09 100644 --- a/LuaLibs/ProcessProfConvex.lua +++ b/LuaLibs/ProcessProfConvex.lua @@ -289,7 +289,7 @@ function ProcessProfConvex.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- aggiungo piano di sgrossatura e lo lavoro local ptStart, vtNP = GetSawCutData( AuxId, vtN) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) - if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then + if AddId and EgtSurfTmFacetElevationInBBox( AddId, 0, b3Solid, GDB_ID.ROOT) > 20.0 then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura diff --git a/LuaLibs/ProcessProfFront.lua b/LuaLibs/ProcessProfFront.lua index 96a3023..aacbc30 100644 --- a/LuaLibs/ProcessProfFront.lua +++ b/LuaLibs/ProcessProfFront.lua @@ -236,7 +236,7 @@ function ProcessProfFront.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- aggiungo piano di sgrossatura e lo lavoro local ptStart, vtNP = GetSawCutData( AuxId, vtN) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) - if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then + if AddId and EgtSurfTmFacetElevationInBBox( AddId, 0, b3Solid, GDB_ID.ROOT) > 20.0 then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura diff --git a/LuaLibs/ProcessProfHead.lua b/LuaLibs/ProcessProfHead.lua index 79ffba0..2006c3c 100644 --- a/LuaLibs/ProcessProfHead.lua +++ b/LuaLibs/ProcessProfHead.lua @@ -271,7 +271,7 @@ function ProcessProfHead.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) -- aggiungo piano di sgrossatura e lo lavoro local ptStart, vtNP = GetSawCutData( AuxId, vtN) local AddId = EgtSurfTmPlaneInBBox( nAddGrpId, ptStart, vtNP, b3Solid, GDB_RT.GLOB) - if AddId and BL.GetFaceElevation( AddId, 0, nPartId) > 20.0 then + if AddId and EgtSurfTmFacetElevationInBBox( AddId, 0, b3Solid, GDB_ID.ROOT) > 20.0 then EgtSetName( AddId, 'AddCut_' .. tostring( Proc.Id)) EgtSetInfo( AddId, 'TASKID', Proc.TaskId) -- se macchina PF o ONE e profilo sopra davanti e pezzo alto applico svuotatura diff --git a/LuaLibs/ProcessVariant.lua b/LuaLibs/ProcessVariant.lua index 0557758..f6e0d9c 100644 --- a/LuaLibs/ProcessVariant.lua +++ b/LuaLibs/ProcessVariant.lua @@ -72,6 +72,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione local function MakePocket( Proc, nRawId, b3Raw, nPartId) + local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) -- recupero gli indici delle facce da lavorare local vFace = EgtGetInfo( Proc.Id, 'Faces', 'vi') if not vFace or #vFace == 0 then @@ -83,7 +84,7 @@ local function MakePocket( Proc, nRawId, b3Raw, nPartId) local dTotDepth = 0 local vDepth = {} for i = 1, #vFace do - vDepth[i] = BL.GetFaceElevation( Proc.Id, vFace[1], nPartId) + vDepth[i] = EgtSurfTmFacetElevationInBBox( Proc.Id, vFace[1], b3Solid, GDB_ID.ROOT) dTotDepth = max( dTotDepth, vDepth[i]) end local vtN = EgtSurfTmFacetNormVersor( Proc.Id, vFace[1], GDB_ID.ROOT) diff --git a/Version.lua b/Version.lua index fa56dd5..8f6ecff 100644 --- a/Version.lua +++ b/Version.lua @@ -3,4 +3,4 @@ NAME = 'Beam' VERSION = '2.5k4' -MIN_EXE = '2.5c1' +MIN_EXE = '2.5k3'