- in FaceData si calcola vtEdge per ogni lato in modo da non doverlo calcolare ogni volta; sostituito in tutte le funzioni
- in LeadInOutLib.CalculateLeadInOut si calcola l'attacco perpendicolare in modo rigoroso - in FACEBYBLADE correzioni al calcolo attacco
This commit is contained in:
@@ -45,10 +45,46 @@ function LeadInOutLib.CalculateLeadInOut( sLeadInOutType, Parameters)
|
||||
LeadIn.dCompLength = 0
|
||||
LeadOut.dCompLength = 0
|
||||
|
||||
-- TODO qui calcolo con EgtLineBoxInters
|
||||
if sLeadInOutType == 'Perpendicular' then
|
||||
LeadIn.dPerpDistance = dDepthToMachine + BeamData.CUT_SIC
|
||||
LeadOut.dPerpDistance = dDepthToMachine + BeamData.CUT_SIC
|
||||
-- informazioni lati adiacenti
|
||||
local nCurrentEdgeIndex = Edge.id + 1
|
||||
local nPreviousEdgeIndex = ( nCurrentEdgeIndex == 1 and #Face.Edges) or nCurrentEdgeIndex - 1
|
||||
local nNextEdgeIndex = ( nCurrentEdgeIndex == #Face.Edges and 1) or nCurrentEdgeIndex + 1
|
||||
local EdgeNext = Face.Edges[nNextEdgeIndex]
|
||||
local EdgePrevious = Face.Edges[nPreviousEdgeIndex]
|
||||
|
||||
-- frame solidale al lato di lavoro (X lungo il lato, Y normale al lato)
|
||||
local frEdge = Frame3d( Edge.ptStart, Face.vtN, Edge.vtEdge)
|
||||
|
||||
-- direzione lati adiacenti nel frame solidale al lato di lavoro
|
||||
local vtEdgeNextLoc = Vector3d( EdgeNext.vtEdge)
|
||||
vtEdgeNextLoc:toLoc( frEdge)
|
||||
local vtEdgePreviousInvLoc = Vector3d( -EdgePrevious.vtEdge)
|
||||
vtEdgePreviousInvLoc:toLoc( frEdge)
|
||||
|
||||
-- profondità di lavoro proiettata sui lati adiacenti
|
||||
local dDepthToMachinePrevious = dDepthToMachine / abs( vtEdgePreviousInvLoc:getY())
|
||||
local dDepthToMachineNext = dDepthToMachine / abs( vtEdgeNextLoc:getY())
|
||||
|
||||
-- punti di inizio e fine lavorazione alla profondità di lavoro reale
|
||||
local ptStartAtDepth = Edge.ptStart + ( -EdgePrevious.vtEdge) * ( EdgePrevious.dLength - dDepthToMachinePrevious)
|
||||
local ptEndAtDepth = Edge.ptEnd + EdgeNext.vtEdge * ( EdgeNext.dLength - dDepthToMachineNext)
|
||||
|
||||
-- distanza dai punti di inizio e fine lavorazione reali al pezzo, nelle direzioni dei lati adiacenti
|
||||
-- TODO bisogna controllare bOk???
|
||||
local b3BoxPartExpanded = BBox3d( Part.b3Part)
|
||||
b3BoxPartExpanded:expand( BeamData.CUT_SIC)
|
||||
local bOkStart, IntersectionTypeStart, PartDistanceStart = EgtLineBoxInters( ptStartAtDepth, -EdgePrevious.vtEdge, b3BoxPartExpanded)
|
||||
local bOkEnd, IntersectionTypeEnd, PartDistanceEnd = EgtLineBoxInters( ptEndAtDepth, EdgeNext.vtEdge, b3BoxPartExpanded)
|
||||
local dDistanceToPartStart = #IntersectionTypeStart > 0 and PartDistanceStart[#PartDistanceStart] or ( dDepthToMachinePrevious + BeamData.COLL_SIC)
|
||||
local dDistanceToPartEnd = #IntersectionTypeEnd > 0 and PartDistanceEnd[#PartDistanceEnd] or ( dDepthToMachineNext + BeamData.COLL_SIC)
|
||||
|
||||
-- componenti dell'attacco con aggiunta la sicurezza
|
||||
LeadIn.dPerpDistance = max( dDistanceToPartStart * vtEdgePreviousInvLoc:getY(), dDepthToMachine)
|
||||
LeadIn.dTangentDistance = max( dDistanceToPartStart, dDepthToMachinePrevious) * -abs( vtEdgePreviousInvLoc:getX())
|
||||
LeadOut.dPerpDistance = max( dDistanceToPartEnd * vtEdgeNextLoc:getY(), dDepthToMachine)
|
||||
LeadOut.dTangentDistance = max( dDistanceToPartEnd, dDepthToMachine) * vtEdgeNextLoc:getX()
|
||||
|
||||
elseif sLeadInOutType == 'Tangent' then
|
||||
LeadIn.dTangentDistance = Tool.dDiameter / 2 + BeamData.CUT_SIC
|
||||
LeadOut.dTangentDistance = Tool.dDiameter / 2 + BeamData.CUT_SIC
|
||||
|
||||
Reference in New Issue
Block a user