- in FaceData si usa la funzione GetAdjacentIndices dove possibile
- in FaceData si accettano, solo per le groove-3, i MainEdges per LongFaces a 5 lati - in FACEBYCHAINSAW modifiche per rispecchiare la direzione utensile calcolata dal Cam5 e MaxElev impostata di conseguenza; invece di usare formule si provano sempre entrambe le soluzioni BlockedAxis, per contemplare tutti i casi
This commit is contained in:
+2
-2
@@ -615,8 +615,8 @@ function BeamLib.GetAdjacentIndices( nCurrentIndex, nMaxIndex)
|
||||
end
|
||||
|
||||
-- circular indexing 1-based
|
||||
nPreviousIndex = ((nCurrentIndex - 2 + nMaxIndex) % nMaxIndex) + 1
|
||||
nNextIndex = (nCurrentIndex % nMaxIndex) + 1
|
||||
nPreviousIndex = ( ( nCurrentIndex - 2 + nMaxIndex) % nMaxIndex) + 1
|
||||
nNextIndex = ( nCurrentIndex % nMaxIndex) + 1
|
||||
|
||||
return nPreviousIndex, nNextIndex
|
||||
end
|
||||
|
||||
+21
-34
@@ -116,14 +116,8 @@ function FaceData.GetEdgesInfo( ProcOrId, idFace )
|
||||
local nFaceType, EdgesEgt = EgtSurfTmGetFacetOutlineInfo( Proc.id, idFace, GDB_ID.ROOT)
|
||||
|
||||
for i = 1, #EdgesEgt do
|
||||
local nPreviousEdgeIndex = i - 1
|
||||
if i == 1 then
|
||||
nPreviousEdgeIndex = #EdgesEgt
|
||||
end
|
||||
local nNextEdgeIndex = i + 1
|
||||
if i == #EdgesEgt then
|
||||
nNextEdgeIndex = 1
|
||||
end
|
||||
|
||||
local nPreviousEdgeIndex, nNextEdgeIndex = BeamLib.GetAdjacentIndices( i, #EdgesEgt)
|
||||
|
||||
-- l'elevazione si tiene sempre positiva e la normale sempre diretta verso l'interno della faccia
|
||||
-- per sapere se il lato è aperto c'è la proprietà apposita bIsOpen
|
||||
@@ -143,6 +137,8 @@ function FaceData.GetEdgesInfo( ProcOrId, idFace )
|
||||
CurrentEdge.vtEdge = CurrentEdge.ptEnd - CurrentEdge.ptStart ; CurrentEdge.vtEdge:normalize()
|
||||
CurrentEdge.sType = 'Standard'
|
||||
CurrentEdge.id = i - 1
|
||||
CurrentEdge.nPreviousEdgeIndex = nPreviousEdgeIndex
|
||||
CurrentEdge.nNextEdgeIndex = nNextEdgeIndex
|
||||
|
||||
-- se nella Proc ci sono le adiacenze e il lato ha adiacenza, si salva l'angolo con la faccia adiacente
|
||||
if Proc.AdjacencyMatrix then
|
||||
@@ -451,14 +447,7 @@ local function GetBottomFaces( Proc)
|
||||
end
|
||||
|
||||
for i = 1, #BottomFaces[1].Edges do
|
||||
local nPreviousEdgeIndex = i - 1
|
||||
if i == 1 then
|
||||
nPreviousEdgeIndex = #BottomFaces[1].Edges
|
||||
end
|
||||
local nNextEdgeIndex = i + 1
|
||||
if i == #BottomFaces[1].Edges then
|
||||
nNextEdgeIndex = 1
|
||||
end
|
||||
local nPreviousEdgeIndex, nNextEdgeIndex = BeamLib.GetAdjacentIndices( i, #BottomFaces[1].Edges)
|
||||
|
||||
local CurrentEdge = {}
|
||||
CurrentEdge.idAdjacentFace = BottomFaces[1].Edges[i].idAdjacentFace
|
||||
@@ -472,6 +461,8 @@ local function GetBottomFaces( Proc)
|
||||
CurrentEdge.ptEnd = BottomFaces[1].Edges[i].ptEnd
|
||||
CurrentEdge.vtEdge = BottomFaces[1].Edges[i].vtEdge
|
||||
CurrentEdge.id = BottomFaces[1].Edges[i].id
|
||||
CurrentEdge.nPreviousEdgeIndex = BottomFaces[1].Edges[i].nPreviousEdgeIndex
|
||||
CurrentEdge.nNextEdgeIndex = BottomFaces[1].Edges[i].nNextEdgeIndex
|
||||
|
||||
if nFirstLongEdgeIndex then
|
||||
if i == nFirstLongEdgeIndex then
|
||||
@@ -540,8 +531,8 @@ local function GetLongFaces( Proc, MainFaces)
|
||||
for i = 1, #LongFaces do
|
||||
LongFaces[i].sType = 'Long'
|
||||
|
||||
-- calcolo MainEdges possibile solo se 4 lati esatti
|
||||
if #LongFaces[i].Edges ~= 4 then
|
||||
-- calcolo MainEdges possibile solo se 4 lati esatti e caso speciale lato opposto groove tagliato
|
||||
if #LongFaces[i].Edges ~= 4 and not ( #LongFaces[i].Edges == 5 and Proc.Topology.sName == 'Groove-3-Through') then
|
||||
break
|
||||
end
|
||||
|
||||
@@ -550,14 +541,7 @@ local function GetLongFaces( Proc, MainFaces)
|
||||
LongFaces[i].MainEdges.OppositeEdges = {}
|
||||
|
||||
for j = 1, #LongFaces[i].Edges do
|
||||
local nPreviousEdgeIndex = j - 1
|
||||
if j == 1 then
|
||||
nPreviousEdgeIndex = #LongFaces[1].Edges
|
||||
end
|
||||
local nNextEdgeIndex = j + 1
|
||||
if j == #LongFaces[i].Edges then
|
||||
nNextEdgeIndex = 1
|
||||
end
|
||||
local nPreviousEdgeIndex, nNextEdgeIndex = BeamLib.GetAdjacentIndices( j, #LongFaces[i].Edges)
|
||||
|
||||
local CurrentEdge = {}
|
||||
CurrentEdge.idAdjacentFace = LongFaces[i].Edges[j].idAdjacentFace
|
||||
@@ -571,6 +555,8 @@ local function GetLongFaces( Proc, MainFaces)
|
||||
CurrentEdge.ptEnd = LongFaces[i].Edges[j].ptEnd
|
||||
CurrentEdge.vtEdge = LongFaces[i].Edges[j].vtEdge
|
||||
CurrentEdge.id = LongFaces[i].Edges[j].id
|
||||
CurrentEdge.nPreviousEdgeIndex = LongFaces[i].Edges[j].nPreviousEdgeIndex
|
||||
CurrentEdge.nNextEdgeIndex = LongFaces[i].Edges[j].nNextEdgeIndex
|
||||
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
if CurrentEdge.idAdjacentFace > -1 then
|
||||
@@ -596,6 +582,12 @@ local function GetLongFaces( Proc, MainFaces)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- il primo OppositeEdge deve essere sempre il più lungo, se più di uno
|
||||
if #LongFaces[i].MainEdges.OppositeEdges > 1 then
|
||||
if LongFaces[i].MainEdges.OppositeEdges[1].dLength < LongFaces[i].MainEdges.OppositeEdges[2].dLength - 10 * GEO.EPS_SMALL then
|
||||
LongFaces[i].MainEdges.OppositeEdges[1], LongFaces[i].MainEdges.OppositeEdges[2] = LongFaces[i].MainEdges.OppositeEdges[2], LongFaces[i].MainEdges.OppositeEdges[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return LongFaces
|
||||
@@ -650,14 +642,7 @@ local function GetSideFaces( Proc, MainFaces)
|
||||
SideFaces[i].MainEdges.OppositeEdges = {}
|
||||
|
||||
for j = 1, #SideFaces[i].Edges do
|
||||
local nPreviousEdgeIndex = j - 1
|
||||
if j == 1 then
|
||||
nPreviousEdgeIndex = #SideFaces[1].Edges
|
||||
end
|
||||
local nNextEdgeIndex = j + 1
|
||||
if j == #SideFaces[i].Edges then
|
||||
nNextEdgeIndex = 1
|
||||
end
|
||||
local nPreviousEdgeIndex, nNextEdgeIndex = BeamLib.GetAdjacentIndices( j, #SideFaces[i].Edges)
|
||||
|
||||
local CurrentEdge = {}
|
||||
CurrentEdge.idAdjacentFace = SideFaces[i].Edges[j].idAdjacentFace
|
||||
@@ -671,6 +656,8 @@ local function GetSideFaces( Proc, MainFaces)
|
||||
CurrentEdge.ptEnd = SideFaces[i].Edges[j].ptEnd
|
||||
CurrentEdge.vtEdge = SideFaces[i].Edges[j].vtEdge
|
||||
CurrentEdge.id = SideFaces[i].Edges[j].id
|
||||
CurrentEdge.nPreviousEdgeIndex = SideFaces[i].Edges[j].nPreviousEdgeIndex
|
||||
CurrentEdge.nNextEdgeIndex = SideFaces[i].Edges[j].nNextEdgeIndex
|
||||
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
if CurrentEdge.idAdjacentFace > -1 then
|
||||
|
||||
@@ -81,12 +81,29 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
local sDepth = OptionalParameters.sDepth or 'TH'
|
||||
local dLongitudinalStepSpan = OptionalParameters.dLongitudinalStepSpan
|
||||
|
||||
-- lunghezze e punti caratteristici della lavorazione e del lato lavorato
|
||||
-- lunghezze, direzioni e punti caratteristici della lavorazione e del lato lavorato
|
||||
Mortising.dEdgeLength = EdgeToMachine.dLength
|
||||
if OppositeToolDirectionMode == 'Enabled' then
|
||||
Mortising.vtToolDirection = -EdgeToMachine.vtN
|
||||
local dCalculatedMaxElev = FaceToMachine.Edges[EdgeToMachine.nPreviousEdgeIndex].dLength
|
||||
if FaceToMachine.Edges[EdgeToMachine.nNextEdgeIndex].dLength > FaceToMachine.Edges[EdgeToMachine.nPreviousEdgeIndex].dLength + 10 * GEO.EPS_SMALL then
|
||||
dCalculatedMaxElev = FaceToMachine.Edges[EdgeToMachine.nNextEdgeIndex].dLength
|
||||
end
|
||||
-- la direzione di lavoro è calcolata in accordo con la direzione calcolata dal Cam5
|
||||
-- fine chiusa
|
||||
if EdgeToMachine.bIsStartOpen and not EdgeToMachine.bIsEndOpen then
|
||||
Mortising.vtToolDirection = FaceToMachine.Edges[EdgeToMachine.nNextEdgeIndex].vtEdge
|
||||
-- inizio chiuso
|
||||
elseif EdgeToMachine.bIsEndOpen and not EdgeToMachine.bIsStartOpen then
|
||||
Mortising.vtToolDirection = -FaceToMachine.Edges[EdgeToMachine.nPreviousEdgeIndex].vtEdge
|
||||
-- entrambi aperti o entrambi chiusi
|
||||
else
|
||||
Mortising.vtToolDirection = EdgeToMachine.vtN
|
||||
local vtTemp = ( FaceToMachine.Edges[EdgeToMachine.nNextEdgeIndex].vtEdge - FaceToMachine.Edges[EdgeToMachine.nPreviousEdgeIndex].vtEdge) * 0.5
|
||||
vtTemp:normalize()
|
||||
Mortising.vtToolDirection = vtTemp
|
||||
end
|
||||
if OppositeToolDirectionMode == 'Enabled' then
|
||||
Mortising.vtToolDirection = -Mortising.vtToolDirection
|
||||
else
|
||||
Mortising.vtToolDirection = Mortising.vtToolDirection
|
||||
end
|
||||
Mortising.vtEdgeDirection = Vector3d( EdgeToMachine.vtEdge)
|
||||
Mortising.ptEdge1, Mortising.ptEdge2 = EdgeToMachine.ptStart, EdgeToMachine.ptEnd
|
||||
@@ -170,6 +187,8 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
-- massima elevazione
|
||||
if dCustomMaxElev < Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
|
||||
Mortising.dMaxElev = max( dCustomMaxElev, dCustomMaxElev - Mortising.dLongitudinalOffset)
|
||||
else
|
||||
Mortising.dMaxElev = dCalculatedMaxElev
|
||||
end
|
||||
-- offset radiale
|
||||
Mortising.dRadialOffset = 0
|
||||
@@ -195,18 +214,8 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
-- SCC
|
||||
Mortising.SCC = MCH_SCC.NONE
|
||||
-- asse bloccato e angoli suggeriti
|
||||
local vtRes = FaceToMachine.vtN ^ EdgeToMachine.vtN
|
||||
if abs( vtRes:getZ()) < 10 * GEO.EPS_SMALL then
|
||||
Mortising.sBlockedAxis = BeamLib.GetBlockedAxis( Mortising.nToolIndex, 'perpendicular', Part.b3Raw, FaceToMachine.vtN)
|
||||
Mortising.sSuggestedAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, EdgeToMachine.vtN, 1)
|
||||
elseif EdgeToMachine.vtN:getZ() < 10 * GEO.EPS_SMALL then
|
||||
Mortising.sBlockedAxis = BeamLib.GetBlockedAxis( Mortising.nToolIndex, 'parallel', Part.b3Raw, FaceToMachine.vtN)
|
||||
Mortising.sSuggestedAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, EdgeToMachine.vtN, 2)
|
||||
-- TODO al momento si contempla solo sega a catena con asse bloccato
|
||||
else
|
||||
Mortising.bIsApplicable = false
|
||||
return Mortising
|
||||
end
|
||||
Mortising.sBlockedAxis = BeamLib.GetBlockedAxis( Mortising.nToolIndex, 'perpendicular', Part.b3Raw, FaceToMachine.vtN)
|
||||
Mortising.sInitialAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, Mortising.vtToolDirection, 1)
|
||||
-- approccio e retrazione
|
||||
Mortising.LeadIn, Mortising.LeadOut = CalculateLeadInOut( Mortising, EdgeToMachine, sSideToMachine, dLengthToMachine)
|
||||
-- check finecorsa nei punti di attacco
|
||||
@@ -219,10 +228,16 @@ function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
vtAux = -FaceToMachine.vtN
|
||||
end
|
||||
local bOutOfStroke = PreSimulationLib.CheckOutOfStrokeFromPoints( PointsOnToolTipCenter, Mortising.vtToolDirection, Mortising.nSCC, TOOLS[Mortising.nToolIndex], vtAux, Mortising.sBlockedAxis)
|
||||
-- se finecorsa si prova a bloccare l'altro asse
|
||||
if bOutOfStroke then
|
||||
Mortising.sMessage = 'Out of stroke'
|
||||
Mortising.bIsApplicable = false
|
||||
return Mortising
|
||||
Mortising.sBlockedAxis = BeamLib.GetBlockedAxis( Mortising.nToolIndex, 'parallel', Part.b3Raw, FaceToMachine.vtN)
|
||||
Mortising.sInitialAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, Mortising.vtToolDirection, 2)
|
||||
bOutOfStroke = PreSimulationLib.CheckOutOfStrokeFromPoints( PointsOnToolTipCenter, Mortising.vtToolDirection, Mortising.nSCC, TOOLS[Mortising.nToolIndex], vtAux, Mortising.sBlockedAxis)
|
||||
if bOutOfStroke then
|
||||
Mortising.sMessage = 'Out of stroke'
|
||||
Mortising.bIsApplicable = false
|
||||
return Mortising
|
||||
end
|
||||
end
|
||||
-- eventuale step verticale
|
||||
Mortising.CloneStepsLongitudinal = {}
|
||||
|
||||
Reference in New Issue
Block a user