Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4f24b32705 |
+11
-14
@@ -9,6 +9,7 @@ require( 'EgtBase')
|
||||
local BeamData = require( 'BeamDataNew')
|
||||
local FaceData = require( 'FaceData')
|
||||
local BeamLib = require( 'BeamLib')
|
||||
local PreSimulationLib = require( 'PreSimulationLib')
|
||||
|
||||
EgtOutLog( ' LeadInOutLib started', 1)
|
||||
|
||||
@@ -71,24 +72,20 @@ end
|
||||
local function CalculateLeadInOutLength( ptToolCenter, vtNFace, b3Box, vtLeadInOut, Tool)
|
||||
|
||||
-- al momento gestita solo lama
|
||||
if not Tool.sFamily == 'SawBlade' then
|
||||
if not Tool.sFamily == 'SAWBLADE' then
|
||||
error(' Tool family not implemented')
|
||||
end
|
||||
|
||||
-- Box del pezzo espansi ortogonalmente alle tre direzioni canoniche X, Y e Z
|
||||
local b3BoxX = BBox3d( b3Box) ; b3BoxX:expand( 0, 1000, 1000)
|
||||
local b3BoxY = BBox3d( b3Box) ; b3BoxY:expand( 1000, 0, 1000)
|
||||
local b3BoxZ = BBox3d( b3Box) ; b3BoxZ:expand( 1000, 1000, 0)
|
||||
local ptStart = Point3d( ptToolCenter)
|
||||
local DistanceData = {}
|
||||
DistanceData.vtNFace = vtNFace
|
||||
DistanceData.vtMove = vtLeadInOut
|
||||
DistanceData.dToolThickness = Tool.dThickness
|
||||
DistanceData.dToolDiameter = Tool.dDiameter
|
||||
DistanceData.sToolFamily = Tool.sFamily
|
||||
DistanceData.ptReferencePoint = ptStart + DistanceData.dToolThickness * DistanceData.vtNFace
|
||||
|
||||
-- si setta utensile lama per il controllo collisione
|
||||
EgtCAvSetSawTool( Tool.dThickness, Tool.dDiameter, Tool.dThickness, 0, 0)
|
||||
|
||||
-- calcolo distanza di cui retrarre con funzioni Tool Collision Avoidance
|
||||
local dLength = min( EgtCAvToolPosBox( ptToolCenter + Tool.dThickness * vtNFace, vtNFace, b3BoxX, vtLeadInOut),
|
||||
EgtCAvToolPosBox( ptToolCenter + Tool.dThickness * vtNFace, vtNFace, b3BoxY, vtLeadInOut),
|
||||
EgtCAvToolPosBox( ptToolCenter + Tool.dThickness * vtNFace, vtNFace, b3BoxZ, vtLeadInOut))
|
||||
|
||||
return dLength
|
||||
return PreSimulationLib.GetDistanceToRetractToolFromRaw( DistanceData, b3Box)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -791,6 +791,25 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
return ToolInfo
|
||||
end
|
||||
|
||||
-- Calcolo profondità massima del foro rispetto al Portautensile (solo per utensile punta)
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function MachiningLib.GetDrillMaxDepthFromToolHolderSideEncumbrance( FeatureInfo, nToolIndex, b3Raw)
|
||||
local b3Box = BBox3d( b3Raw)
|
||||
b3Box:expand( BeamData.COLL_SIC)
|
||||
local ptStart = Point3d( FeatureInfo.ptDrillCenter)
|
||||
local dToolLength = TOOLS[nToolIndex].dLength
|
||||
local dMaxDepth = TOOLS[nToolIndex].dMaxDepth
|
||||
local DistanceData = {}
|
||||
DistanceData.vtNFace = Vector3d( FeatureInfo.vtDrillExtrusion)
|
||||
DistanceData.vtMove = Vector3d( FeatureInfo.vtDrillExtrusion)
|
||||
DistanceData.dToolLength = TOOLS[nToolIndex].ToolHolder.dLength
|
||||
DistanceData.dToolDiameter = TOOLS[nToolIndex].ToolHolder.dDiameter
|
||||
DistanceData.sToolFamily = 'TOOLHOLDER'
|
||||
DistanceData.ptReferencePoint = ptStart + ( ( dToolLength - dMaxDepth - DistanceData.dToolLength) * DistanceData.vtNFace)
|
||||
|
||||
return PreSimulationLib.GetDistanceToRetractToolFromRaw( DistanceData, b3Box)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- funzione per cercare utensile tipo PUNTA A FORARE con certe caratteristiche
|
||||
function MachiningLib.FindDrill( Proc, ToolSearchParameters)
|
||||
@@ -907,6 +926,13 @@ function MachiningLib.FindDrill( Proc, ToolSearchParameters)
|
||||
ToolInfo.nToolIndex = nBestToolIndex
|
||||
ToolInfo.dResidualDepth = dBestToolResidualDepth
|
||||
|
||||
if nBestToolIndex then
|
||||
local dTHReduction = MachiningLib.GetDrillMaxDepthFromToolHolderSideEncumbrance( Proc.FeatureInfo, nBestToolIndex, ToolSearchParameters.Part.b3Raw)
|
||||
local dTHResidualDepth = ToolSearchParameters.dElevation + dTHReduction - TOOLS[nBestToolIndex].dMaxDepth
|
||||
if dTHResidualDepth < dBestToolResidualDepth then
|
||||
ToolInfo.dResidualDepth = dTHResidualDepth
|
||||
end
|
||||
end
|
||||
-- si salva se la punta ha lo stesso diametro del foro
|
||||
if nBestToolIndex and TOOLS[nBestToolIndex].dDiameter - ToolSearchParameters.dToolDiameter > 100 * GEO.EPS_SMALL then
|
||||
ToolInfo.bDrillIsExactDiameter = true
|
||||
|
||||
@@ -103,6 +103,35 @@ function PreSimulationLib.GetPointOnToolTipCenter( ptPointAtDepth, vtHead, vtNFa
|
||||
return ptPointAtDepth + vtToolOffset * Tool.dDiameter / 2 + vtNFace * EgtIf( AreSameVectorApprox( vtHead, vtNFace), 0, Tool.dThickness)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function PreSimulationLib.GetDistanceToRetractToolFromRaw( DistanceData, b3Box)
|
||||
-- Box del pezzo espansi ortogonalmente alle tre direzioni canoniche X, Y e Z
|
||||
local b3BoxX = BBox3d( b3Box) ; b3BoxX:expand( 0, 1000, 1000)
|
||||
local b3BoxY = BBox3d( b3Box) ; b3BoxY:expand( 1000, 0, 1000)
|
||||
local b3BoxZ = BBox3d( b3Box) ; b3BoxZ:expand( 1000, 1000, 0)
|
||||
|
||||
-- Imposta l'utensile correttamente
|
||||
if DistanceData.sToolFamily == 'DRILLBIT' then
|
||||
-- si setta utensile Punta per il controllo collisione
|
||||
EgtCAvSetAdvTool( DistanceData.dToolLength, DistanceData.dToolDiameter, ( DistanceData.dToolTotalLength - DistanceData.dToolLength), 0, 0)
|
||||
elseif DistanceData.sToolFamily == 'SAWBLADE' then
|
||||
-- si setta utensile Lama per il controllo collisione
|
||||
EgtCAvSetSawTool( DistanceData.dToolThickness, DistanceData.dToolDiameter, DistanceData.dToolThickness, 0, 0)
|
||||
elseif DistanceData.sToolFamily == 'TOOLHOLDER' then
|
||||
-- si setta utensile Cilindrico per simulare il portautensile in caso di fori inclinati nei quali è possibile che il portautensile collida
|
||||
EgtCAvSetStdTool( DistanceData.dToolLength, DistanceData.dToolDiameter, 0)
|
||||
-- altre tipologie non gestite
|
||||
else
|
||||
return nil
|
||||
end
|
||||
|
||||
-- calcolo distanza di cui retrarre con funzioni Tool Collision Avoidance *da top dell'utensile*
|
||||
local dLength = min( EgtCAvToolPosBox( DistanceData.ptReferencePoint, DistanceData.vtNFace, b3BoxX, DistanceData.vtMove),
|
||||
EgtCAvToolPosBox( DistanceData.ptReferencePoint, DistanceData.vtNFace, b3BoxY, DistanceData.vtMove),
|
||||
EgtCAvToolPosBox( DistanceData.ptReferencePoint, DistanceData.vtNFace, b3BoxZ, DistanceData.vtMove))
|
||||
return dLength
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- calcolo punto sull'uscita testa a partire dal punto di lavorazione o di attacco sul diametro utensile
|
||||
local function GetToolExitPoint( ptMachining, vtNEdge, vtHead, Tool, bIsDownUp)
|
||||
|
||||
@@ -8,6 +8,7 @@ local BeamLib = require( 'BeamLib')
|
||||
local BeamData = require( 'BeamDataNew')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
local FeatureLib = require( 'FeatureLib')
|
||||
local PreSimulationLib = require( 'PreSimulationLib')
|
||||
-- strategie di base
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -37,6 +38,24 @@ local function GetSCC( vtMachiningDirection)
|
||||
return nSCC
|
||||
end
|
||||
|
||||
-- Calcolo distanza dalla quale andare a velocità di lavoro ( Start Safety Length)
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetDrillApprochSafeDistance( FeatureInfo, nToolIndex, b3Raw)
|
||||
local b3Box = BBox3d( b3Raw)
|
||||
b3Box:expand( BeamData.COLL_SIC)
|
||||
local ptStart = Point3d( FeatureInfo.ptDrillCenter)
|
||||
local DistanceData = {}
|
||||
DistanceData.vtNFace = Vector3d( FeatureInfo.vtDrillExtrusion)
|
||||
DistanceData.vtMove = Vector3d( FeatureInfo.vtDrillExtrusion)
|
||||
DistanceData.dToolLength = TOOLS[nToolIndex].dLength
|
||||
DistanceData.dToolTotalLength = TOOLS[nToolIndex].dTotalLength
|
||||
DistanceData.dToolDiameter = TOOLS[nToolIndex].dDiameter
|
||||
DistanceData.sToolFamily = TOOLS[nToolIndex].sFamily
|
||||
DistanceData.ptReferencePoint = ptStart + DistanceData.dToolLength * DistanceData.vtNFace
|
||||
|
||||
return PreSimulationLib.GetDistanceToRetractToolFromRaw( DistanceData, b3Box)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetDrillingStrategy( Proc, Part)
|
||||
local ToolSearchParameters = {}
|
||||
@@ -51,6 +70,7 @@ local function GetDrillingStrategy( Proc, Part)
|
||||
ToolSearchParameters.dDiameterTolerance = Strategy.Parameters.dDiameterTolerance
|
||||
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sDrillBitList, 'Drilling')
|
||||
ToolSearchParameters.ptCheckOutStroke = { Proc.FeatureInfo.ptDrillCenter + ( EgtMdbGetGeneralParam( MCH_GP.SAFEZ) * ToolSearchParameters.vtToolDirection)}
|
||||
ToolSearchParameters.Part = Part
|
||||
|
||||
Drilling.ToolInfo = {}
|
||||
Drilling.ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters)
|
||||
@@ -61,6 +81,7 @@ local function GetDrillingStrategy( Proc, Part)
|
||||
Drilling.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
|
||||
Drilling.dStep = TOOLS[Drilling.nToolIndex].dStep
|
||||
Drilling.nSCC = GetSCC( -Drilling.vtToolDirection)
|
||||
Drilling.dStartSafetyLength = max( BeamData.COLL_SIC, GetDrillApprochSafeDistance( Proc.FeatureInfo, Drilling.ToolInfo.nToolIndex, Part.b3Raw))
|
||||
end
|
||||
|
||||
-- TODO se utensile 2 che si torverà è il gemello da usare nelle lavorazioni in doppio, allora gestire di conseguenza l'applicazione delle lavorazioni in doppio
|
||||
@@ -84,6 +105,7 @@ local function GetDrillingStrategy( Proc, Part)
|
||||
Drilling2.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
|
||||
Drilling2.dStep = TOOLS[Drilling2.nToolIndex].dStep
|
||||
Drilling2.nSCC = GetSCC( -Drilling2.vtToolDirection)
|
||||
Drilling2.dStartSafetyLength = max( BeamData.COLL_SIC, GetDrillApprochSafeDistance( Proc.FeatureInfo, Drilling.ToolInfo.nToolIndex, Part.b3Raw))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user