- in BeamLib aggiunta funzione TableCopyDeep per copiare una tabella mantenendo senza riferimenti le sottotabelle
- in STR0004 primo implemento di spezzatura lavorazioni, da completare - in SLOTBYCHAINSAW scritti alcuni parametri realtivi al lato nel Machining
This commit is contained in:
@@ -396,7 +396,39 @@ function BeamLib.CalculateStringBinaryFormat( dNumber, CharNumber)
|
||||
while #NumberString < CharNumber do
|
||||
NumberString = '0' .. NumberString
|
||||
end
|
||||
|
||||
return NumberString
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
--- copia una tabella lua in modo ricorsivo, ossia mantiene indipendenti anche tutte le sottotabelle
|
||||
--- ATTENZIONE: in caso di modifiche vanno gestiti anche i tipi custom; sarebbe meglio metterla nel LuaLibs
|
||||
function BeamLib.TableCopyDeep( OriginalTable)
|
||||
local CopiedTable = {}
|
||||
for key, value in pairs( OriginalTable) do
|
||||
if type( value) == "table" then
|
||||
if isBBox3d( value) then
|
||||
CopiedTable[ key] = BBox3d( value)
|
||||
elseif isColor3d( value) then
|
||||
CopiedTable[ key] = Color3d( value)
|
||||
elseif isFrame3d( value) then
|
||||
CopiedTable[ key] = Frame3d( value)
|
||||
elseif isPoint3d( value) then
|
||||
CopiedTable[ key] = Point3d( value)
|
||||
elseif isQuaternion( value) then
|
||||
CopiedTable[ key] = Quaternion( value)
|
||||
elseif isVector3d( value) then
|
||||
CopiedTable[ key] = Vector3d( value)
|
||||
else
|
||||
CopiedTable[ key] = BeamLib.TableCopyDeep( value)
|
||||
end
|
||||
else
|
||||
CopiedTable[ key] = value
|
||||
end
|
||||
end
|
||||
|
||||
return CopiedTable
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return BeamLib
|
||||
|
||||
@@ -67,6 +67,12 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
local dCustomMaxElev = OptionalParameters.dMaxElev or abs( EdgeToMachine.dElevation)
|
||||
local bStopAtHalfElevation = OptionalParameters.bStopAtHalfElevation or false
|
||||
|
||||
-- lunghezze e punti caratteristici della lavorazione e del lato lavorato
|
||||
Mortising.dLengthToMachine = dLengthToMachine
|
||||
Mortising.dLengthOnX = dLengthToMachine * EdgeToMachine.vtToolDirection:getY()
|
||||
Mortising.dEdgeLength = EdgeToMachine.dLength
|
||||
Mortising.ptEdge1, _, Mortising.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -EdgeToMachine.vtToolDirection, GDB_ID.ROOT)
|
||||
|
||||
-- altezza tasca, in base alla topologia
|
||||
local dPocketHeight = 0
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
|
||||
@@ -195,47 +195,82 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
end
|
||||
|
||||
-- lavorazioni raggruppate in unica lista, che verrà poi riordinata
|
||||
Chainsaw.Result.Sorted = {}
|
||||
for i = 1, #Chainsaw.Result.Side do
|
||||
if Chainsaw.Result.Side[i].bIsApplicable then
|
||||
table.insert( Chainsaw.Result.Sorted, Chainsaw.Result.Side[i])
|
||||
end
|
||||
end
|
||||
for i = 1, #Chainsaw.Result.Bottom do
|
||||
if Chainsaw.Result.Bottom[i].bIsApplicable then
|
||||
table.insert( Chainsaw.Result.Sorted, Chainsaw.Result.Bottom[i])
|
||||
end
|
||||
end
|
||||
for i = 1, #Chainsaw.Result.Opposite do
|
||||
if Chainsaw.Result.Opposite[i].bIsApplicable then
|
||||
table.insert( Chainsaw.Result.Sorted, Chainsaw.Result.Opposite[i])
|
||||
end
|
||||
end
|
||||
-- calcolo eventuali spezzoni
|
||||
local vFeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
|
||||
-- aggiunta eventuali lavorazioni splittate e ordinamento
|
||||
if #vFeatureSplittingPoints > 0 then
|
||||
for i = #Chainsaw.Result.Sorted, 1, -1 do
|
||||
if FeatureLib.MachiningNeedsSplitting( Chainsaw.Result.Sorted[i].dLengthOnX, Part) then
|
||||
for j = 1, #vFeatureSplittingPoints do
|
||||
local nCurrentMachiningIndex = i + j - 1
|
||||
if j > 1 then
|
||||
table.insert( Chainsaw.Result.Sorted, nCurrentMachiningIndex, BeamLib.TableCopyDeep( Chainsaw.Result.Sorted[i]))
|
||||
end
|
||||
|
||||
local dEdgeMaxX = Chainsaw.Result.Sorted[nCurrentMachiningIndex].ptEdge1:getX()
|
||||
local dEdgeMinX = Chainsaw.Result.Sorted[nCurrentMachiningIndex].ptEdge2:getX()
|
||||
if Chainsaw.Result.Sorted[nCurrentMachiningIndex].ptEdge1:getX() < Chainsaw.Result.Sorted[nCurrentMachiningIndex].ptEdge2:getX() - 10 * GEO.EPS_SMALL then
|
||||
dEdgeMaxX = Chainsaw.Result.Sorted[nCurrentMachiningIndex].ptEdge2:getX()
|
||||
dEdgeMinX = Chainsaw.Result.Sorted[nCurrentMachiningIndex].ptEdge1:getX()
|
||||
end
|
||||
|
||||
local dStartAddLength = 0
|
||||
local dEndAddLength = 0
|
||||
if j == 1 then
|
||||
dEndAddLength = - ( vFeatureSplittingPoints[j]:getX() - dEdgeMinX)
|
||||
elseif j == #vFeatureSplittingPoints then
|
||||
dStartAddLength = - ( dEdgeMaxX - vFeatureSplittingPoints[j - 1]:getX())
|
||||
else
|
||||
dStartAddLength = - ( dEdgeMaxX - vFeatureSplittingPoints[j - 1]:getX())
|
||||
dEndAddLength = - ( vFeatureSplittingPoints[j]:getX() - dEdgeMinX)
|
||||
end
|
||||
if Chainsaw.Result.Sorted[nCurrentMachiningIndex].bInvert then
|
||||
dStartAddLength, dEndAddLength = dEndAddLength, dStartAddLength
|
||||
end
|
||||
|
||||
Chainsaw.Result.Sorted[nCurrentMachiningIndex].LeadIn.dStartAddLength = Chainsaw.Result.Sorted[nCurrentMachiningIndex].LeadIn.dStartAddLength + dStartAddLength
|
||||
Chainsaw.Result.Sorted[nCurrentMachiningIndex].LeadOut.dEndAddLength = Chainsaw.Result.Sorted[nCurrentMachiningIndex].LeadOut.dEndAddLength + dEndAddLength
|
||||
end
|
||||
|
||||
-- ultimo segmento
|
||||
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
end
|
||||
|
||||
-- aggiunta lavorazioni
|
||||
local nIsApplicableCount = 0
|
||||
local dFinalCompletionPercentage = 100
|
||||
local bAreAllMachiningsAdded = true
|
||||
for i = 1, #Chainsaw.Result.Bottom do
|
||||
if Chainsaw.Result.Bottom[i].bIsApplicable then
|
||||
for i = 1, #Chainsaw.Result.Sorted do
|
||||
if Chainsaw.Result.Sorted[i].bIsApplicable then
|
||||
nIsApplicableCount = nIsApplicableCount + 1
|
||||
if bAddMachining then
|
||||
local bIsMachiningAdded = Chainsaw.AddMachiningAllSteps( Proc, Chainsaw.Result.Bottom[i])
|
||||
local bIsMachiningAdded = Chainsaw.AddMachiningAllSteps( Proc, Chainsaw.Result.Sorted[i])
|
||||
if not bIsMachiningAdded then
|
||||
bAreAllMachiningsAdded = false
|
||||
end
|
||||
end
|
||||
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Chainsaw.Result.Bottom[i].sMessage
|
||||
end
|
||||
end
|
||||
for i = 1, #Chainsaw.Result.Side do
|
||||
if Chainsaw.Result.Side[i].bIsApplicable then
|
||||
nIsApplicableCount = nIsApplicableCount + 1
|
||||
if bAddMachining then
|
||||
local bIsMachiningAdded = Chainsaw.AddMachiningAllSteps( Proc, Chainsaw.Result.Side[i])
|
||||
if not bIsMachiningAdded then
|
||||
bAreAllMachiningsAdded = false
|
||||
end
|
||||
end
|
||||
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Chainsaw.Result.Side[i].sMessage
|
||||
end
|
||||
end
|
||||
for i = 1, #Chainsaw.Result.Opposite do
|
||||
if Chainsaw.Result.Opposite[i].bIsApplicable then
|
||||
nIsApplicableCount = nIsApplicableCount + 1
|
||||
if bAddMachining then
|
||||
local bIsMachiningAdded = Chainsaw.AddMachiningAllSteps( Proc, Chainsaw.Result.Opposite[i])
|
||||
if not bIsMachiningAdded then
|
||||
bAreAllMachiningsAdded = false
|
||||
end
|
||||
end
|
||||
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Chainsaw.Result.Opposite[i].sMessage
|
||||
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Chainsaw.Result.Sorted[i].sMessage
|
||||
end
|
||||
end
|
||||
if nIsApplicableCount > 0 then
|
||||
|
||||
Reference in New Issue
Block a user