DataWall :

- corretta gestione FreeContour per errore inserito in precedente rilascio
- aggiunt gestione prefori (da parametri WD.PREDRILL_MINANGLE e WD.PREDRILL_DIAM).
This commit is contained in:
DarioS
2022-02-22 12:26:42 +01:00
parent a97971bdec
commit 688b4e8e01
4 changed files with 85 additions and 19 deletions
+16 -14
View File
@@ -126,20 +126,22 @@ function WMachiningLib.FindSawing( sType)
end
---------------------------------------------------------------------
function WMachiningLib.FindDrilling( dDiam, dDepth, sHead)
-- ricerca sulle forature, dal diametro maggiore al minore
for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == 'Drill' and SetCurrMachiningAndTool( Drilling.Name) then
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if nMchType == MCH_MY.DRILLING and
dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - WD.DRILL_TOL - 10 * GEO.EPS_SMALL and
( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) and
(( not sHead and sMyHead ~= 'H5' and sMyHead ~= 'H6') or sHead == sMyHead) then
return Drilling.Name, Drilling.Type, dTMaxMat
function WMachiningLib.FindDrilling( dDiam, dDepth, sHead, bOnlyPockets)
if bOnlyPockets == nil or not bOnlyPockets then
-- ricerca sulle forature, dal diametro maggiore al minore
for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == 'Drill' and SetCurrMachiningAndTool( Drilling.Name) then
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if nMchType == MCH_MY.DRILLING and
dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - WD.DRILL_TOL - 10 * GEO.EPS_SMALL and
( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) and
(( not sHead and sMyHead ~= 'H5' and sMyHead ~= 'H6') or sHead == sMyHead) then
return Drilling.Name, Drilling.Type, dTMaxMat
end
end
end
end
+64 -2
View File
@@ -12,6 +12,7 @@ local WPD = {}
-- Include
require( 'EgtBase')
local WL = require( 'WallLib')
EgtOutLog( ' WProcessDrill started', 1)
@@ -421,11 +422,72 @@ function WPD.Make( Proc, nRawId, b3Raw)
EgtSetOperationMode( nMchId, false)
return false, sWarn
else
return true, ( sMyWarn or sWarn)
sMyWarn = (sMyWarn or sWarn)
end
end
if WD.PREDRILL_DIAM > 0 and vtExtr:getZ() < WD.PREDRILL_MINANGLE then
-- gruppo ausiliario per preforo
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
-- calcolo profondita' foro
local dLen = ( WD.PREDRILL_DIAM / 2) * sqrt( 1 - vtExtr:getZ() * vtExtr:getZ()) / vtExtr:getZ()
-- copio foro originale
local nPreHoleId = EgtCopyGlob( AuxId, nAddGrpId)
EgtModifyArcRadius( nPreHoleId, WD.PREDRILL_DIAM / 2)
EgtModifyCurveThickness( nPreHoleId, -dLen) --dLen = 10
-- se da invertire
if bToInvert then
-- lo sposto della lunghezza d'estrusione e ne inverto il versore
local dThickness = EgtCurveThickness( AuxId)
EgtMove( nPreHoleId, abs( dThickness) * vtExtr, GDB_RT.GLOB)
EgtModifyCurveExtrusion( nPreHoleId, vtExtr, GDB_RT.GLOB)
end
-- recupero lavorazione di pocket
local sDrilling = WM.FindDrilling( WD.PREDRILL_DIAM, dLen, nil, true) --dLen = 10
if not sDrilling then
local sErr = 'Error : prehole pocket not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione
local sName = 'PreDrill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sDrilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sDrilling
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchId, 'Part', Proc.PartId)
-- setto la nota per spostarla prima della foratura
EgtSetInfo( nMchId, 'MOVE_BEFORE', 1)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nPreHoleId, -1}})
--EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
-- note utente, dichiarazione nessuna generazione sfridi per Vmill
local sUserNotes = 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
local _, sWarn = EgtGetMachMgrWarning( 0)
if EgtIsMachiningEmpty() then
EgtSetOperationMode( nMchId, false)
return false, sWarn
else
sMyWarn = (sMyWarn or sWarn)
end
end
end
return true, sMyWarn
end
---------------------------------------------------------------------
+3 -3
View File
@@ -1230,9 +1230,9 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
if #vFace == 1 then dSal = -dMillDiam / 2 end
-- se angolo interno prima
if vFace[i].PrevAng < -30 then
local dSinA = -sin( vFace[OrigI].PlPrevAng + 90)
local dTanA = -tan( vFace[OrigI].PlPrevAng + 90)
dSal = -dMillDiam / 2 * ( 1 + ( 1 + dSinA) * dTanA) + min( 0, vFace[OrigI].Width * vFace[OrigI].Norm:getZ() * dTanA)
local dSinA = -sin( vFace[i].PlPrevAng + 90)
local dTanA = -tan( vFace[i].PlPrevAng + 90)
dSal = -dMillDiam / 2 * ( 1 + ( 1 + dSinA) * dTanA) + min( 0, vFace[i].Width * vFace[i].Norm:getZ() * dTanA)
-- se faccia precedente inclinata verso il basso
if j and vFace[j].Norm:getZ() < -0.017 then
dSal = dSal + vFace[j].Width * vFace[j].Norm:getZ()
+2
View File
@@ -534,6 +534,8 @@ local function SortMachinings( nPhase, PrevMch, nPartId)
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MORTISING, { 'Csaw_'}, false)
-- Forature orizzontali con punte lunghe
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.DRILLING, { 'LhDrill_'}, true, 'MOVE_AFTER', false, true)
-- Preforature per fori inclinati
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.POCKETING, { 'PreDrill_'}, true, nil, false, false)
-- Forature e Svuotature
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.DRILLING + MCH_OY.POCKETING + MCH_OY.MILLING, { 'SideMill_', 'Clean_'}, false, 'MOVE_AFTER', false, false, true)
-- -- Forature ***