diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index b96eeac..bb46077 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -223,6 +223,11 @@ if bToProcess then sOut = sOut:sub( 1, -3) EgtOutLog( 'Pareti trovate : ' .. sOut, 1) end + -- variabile che indica se ci sono fori orizzontali lunghi + local bUseMinRawYForLongDrill = false + -- recupero libreria fori + _G.package.loaded.WProcessDrill = nil + local Drill = require( 'WProcessDrill') -- Ne recupero le dimensioni for i = 1, #vWall do local Ls = EgtGetFirstNameInGroup( vWall[i].Id, 'Box') @@ -236,10 +241,23 @@ if bToProcess then else vWall[i].Box = b3Solid end + -- recupero lista feature e ciclo + local vPartProc = WE.CollectFeatures( vWall[i].Id) + for nInd = 1, #vPartProc do + if Drill.Identify( vPartProc[nInd]) and Drill.UseMinYForLongDrill(vPartProc[nInd]) then + bUseMinRawYForLongDrill = true + end + end + end + -- se parete con fori lunghi orizzontali + local dMinY = 0 + if bUseMinRawYForLongDrill then + -- considero minima larghezza per permettere di farli + dMinY = WD.MINRAWY_HOR_DRILL end -- Assegno dimensioni del pannello dPanelLen = vWall[1].Box:getDimX() + 20 - dPanelWidth = vWall[1].Box:getDimY() + 20 + dPanelWidth = math.max( vWall[1].Box:getDimY() + 20, dMinY) -- Assegno posizione prima ed unica parete vWall[1].PosX = 10 vWall[1].PosZ = 10 diff --git a/LuaLibs/WProcessDrill.lua b/LuaLibs/WProcessDrill.lua index 3deb9bc..053ba0d 100644 --- a/LuaLibs/WProcessDrill.lua +++ b/LuaLibs/WProcessDrill.lua @@ -140,10 +140,8 @@ function WPD.RotateClassify( Proc) local dLen = abs( EgtCurveThickness( AuxId)) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local ptCen = EgtCP( AuxId, GDB_RT.GLOB) - -- se foro da 35 orizzontale - local HorizDrillDiam = 35 - local HorizDrillTol = 4 - if dDiam <= HorizDrillDiam + HorizDrillTol and dDiam >= HorizDrillDiam - HorizDrillTol and vtExtr:getZ() > -0.1 and vtExtr:getZ() < 0.1 then + -- se foro orizzontale con punta lunga + if dDiam <= WD.HOR_DRILL_DIAM + WD.DRILL_TOL and dDiam >= WD.HOR_DRILL_DIAM - WD.DRILL_TOL and vtExtr:getZ() > -0.1 and vtExtr:getZ() < 0.1 then -- se orientato perpendicolare ad X if AreSameOrOppositeVectorApprox( vtExtr, X_AX()) then nRot0 = 0 @@ -165,6 +163,42 @@ function WPD.RotateClassify( Proc) end +function WPD.IsHorizLongDrill( Proc) + -- recupero e verifico l'entità foro + local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 + if AuxId then AuxId = AuxId + Proc.Id end + if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then + return false + end + -- recupero i dati del foro + local dDiam = 2 * EgtArcRadius( AuxId) + local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) + return dDiam <= WD.HOR_DRILL_DIAM + WD.DRILL_TOL and dDiam >= WD.HOR_DRILL_DIAM - WD.DRILL_TOL and vtExtr:getZ() > -0.1 and vtExtr:getZ() < 0.1 +end + +function WPD.UseMinYForLongDrill( Proc) + if WPD.IsHorizLongDrill( Proc) then + -- recupero e verifico l'entità foro + local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 + if AuxId then AuxId = AuxId + Proc.Id end + if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then + return false + end + -- recupero i dati del foro + local dDiam = 2 * EgtArcRadius( AuxId) + local dLen = abs( EgtCurveThickness( AuxId)) + local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) + local ptCen = EgtCP( AuxId, GDB_RT.GLOB) + local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0) + -- se foro lungo orizzontale e piu' lungo della punta o orientato in Y- + if dDiam <= WD.HOR_DRILL_DIAM + WD.DRILL_TOL and dDiam >= WD.HOR_DRILL_DIAM - WD.DRILL_TOL and vtExtr:getZ() > -0.1 and vtExtr:getZ() < 0.1 and + ( (bOpen and dLen > WD.HOR_DRILL_LEN) or ( not bOpen and vtExtr:getY() < 0)) then + return true + end + end + return false +end + --------------------------------------------------------------------- -- Verifica se da lavorare in due metà function WPD.Split( Proc, b3Raw)