|
|
|
@@ -2551,7 +2551,7 @@ end
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
local function MakeChamfer( Proc, bIs3Faces, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham)
|
|
|
|
|
|
|
|
|
|
-- Se variabile globale indica che lo smusso è gi stato fatto, esco
|
|
|
|
|
-- Se variabile globale indica che lo smusso è già stato fatto, esco
|
|
|
|
|
if bMadeChamfer then
|
|
|
|
|
return 0
|
|
|
|
|
end
|
|
|
|
@@ -2565,6 +2565,7 @@ local function MakeChamfer( Proc, bIs3Faces, nAddGrpId, vtOrtho, b3Solid, nSurfI
|
|
|
|
|
end
|
|
|
|
|
-- ottengo le curve di contorno libero
|
|
|
|
|
local nAuxId1, nAuxId2, nNumIdAux
|
|
|
|
|
local bIsOpenPath = false
|
|
|
|
|
if bIs3Faces then
|
|
|
|
|
-- estraggo i percorsi
|
|
|
|
|
nAuxId1, nNumIdAux = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId)
|
|
|
|
@@ -2575,6 +2576,36 @@ local function MakeChamfer( Proc, bIs3Faces, nAddGrpId, vtOrtho, b3Solid, nSurfI
|
|
|
|
|
else
|
|
|
|
|
nAuxId1, nNumIdAux = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId)
|
|
|
|
|
if not nNumIdAux then nNumIdAux = 0 end
|
|
|
|
|
-- se non è una curva chiusa bisogna estrarre le sole curve da lavorare
|
|
|
|
|
if Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4' then
|
|
|
|
|
local IdsToMachine = {}
|
|
|
|
|
bIsOpenPath = true
|
|
|
|
|
local nFirstId, nIdCount = EgtExplodeCurveCompo( nAuxId1)
|
|
|
|
|
for i = nFirstId, nFirstId + nIdCount - 1, 1 do
|
|
|
|
|
-- se segmento di retta
|
|
|
|
|
if EgtGetType( i) == GDB_TY.CRV_LINE then
|
|
|
|
|
local _, nEntitiesCount = EgtCurveDomain(i)
|
|
|
|
|
for j = 0, nEntitiesCount - 1 do
|
|
|
|
|
local ptStart = EgtUP( i, j, GDB_RT.GLOB)
|
|
|
|
|
local ptEnd = EgtUP( i, j + 1, GDB_RT.GLOB)
|
|
|
|
|
if ( AreSameVectorApprox( vtOrtho, X_AX()) and ( abs( ptStart:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL and abs( ptEnd:getX() - b3Solid:getMax():getX()) < 100 * GEO.EPS_SMALL) or
|
|
|
|
|
AreSameVectorApprox( vtOrtho, -X_AX()) and ( abs( ptStart:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL and abs( ptEnd:getX() - b3Solid:getMin():getX()) < 100 * GEO.EPS_SMALL) or
|
|
|
|
|
AreSameVectorApprox( vtOrtho, Y_AX()) and ( abs( ptStart:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL and abs( ptEnd:getY() - b3Solid:getMax():getY()) < 100 * GEO.EPS_SMALL) or
|
|
|
|
|
AreSameVectorApprox( vtOrtho, -Y_AX()) and ( abs( ptStart:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL and abs( ptEnd:getY() - b3Solid:getMin():getY()) < 100 * GEO.EPS_SMALL) or
|
|
|
|
|
AreSameVectorApprox( vtOrtho, Z_AX()) and ( abs( ptStart:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL and abs( ptEnd:getZ() - b3Solid:getMax():getZ()) < 100 * GEO.EPS_SMALL) or
|
|
|
|
|
AreSameVectorApprox( vtOrtho, -Z_AX()) and ( abs( ptStart:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL and abs( ptEnd:getZ() - b3Solid:getMin():getZ()) < 100 * GEO.EPS_SMALL)
|
|
|
|
|
) then
|
|
|
|
|
table.insert( IdsToMachine, i)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local ptNear = EgtSurfTmFacetCenter(Proc.Id, 0, GDB_ID.ROOT)
|
|
|
|
|
nAuxId1 = EgtCurveCompoByReorder( nAddGrpId, IdsToMachine, ptNear, true, GDB_ID.ROOT)
|
|
|
|
|
nNumIdAux = 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local dExtra = 2
|
|
|
|
@@ -2594,13 +2625,20 @@ local function MakeChamfer( Proc, bIs3Faces, nAddGrpId, vtOrtho, b3Solid, nSurfI
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
AuxId = nAuxId1 + i - 1
|
|
|
|
|
vtExtr, _, _ = EgtCurveArea( AuxId)
|
|
|
|
|
end
|
|
|
|
|
if vtExtr then
|
|
|
|
|
if not bIs3Faces then
|
|
|
|
|
if bIsOpenPath then
|
|
|
|
|
_, vtExtr = EgtCurveIsFlat( AuxId)
|
|
|
|
|
else
|
|
|
|
|
vtExtr, _, _ = EgtCurveArea( AuxId)
|
|
|
|
|
end
|
|
|
|
|
if vtExtr then
|
|
|
|
|
local fFrCurve = EgtGetGlobFrame( AuxId)
|
|
|
|
|
vtExtr:toGlob( fFrCurve)
|
|
|
|
|
if bIsOpenPath and vtExtr * vtOrtho < GEO.EPS_SMALL then
|
|
|
|
|
vtExtr = -vtExtr
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if vtExtr then
|
|
|
|
|
-- if bIs3Faces and i == nNumIdAux then
|
|
|
|
|
-- vtExtr = -vtExtr
|
|
|
|
|
-- end
|
|
|
|
@@ -2844,6 +2882,12 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
|
|
|
|
local nOk, sErr = MakeChamfer( Proc, bIs3Faces, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham)
|
|
|
|
|
if nOk < 0 then return false, sErr end
|
|
|
|
|
end
|
|
|
|
|
-- slot aperta su due lati
|
|
|
|
|
elseif Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4' then
|
|
|
|
|
if nChamfer > 0 then
|
|
|
|
|
local nOk, sErr = MakeChamfer( Proc, false, nAddGrpId, rfFac:getVersZ(), b3Solid, nil, dDepthCham)
|
|
|
|
|
if nOk < 0 then return false, sErr end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if not dDepth then dDepth = dElev end
|
|
|
|
|
-- Recupero le facce adiacenti alla principale
|
|
|
|
@@ -5110,22 +5154,29 @@ function SawPlusChain.ApplyMachining( Machining, b3Raw)
|
|
|
|
|
local nErr
|
|
|
|
|
nErr, sErr = EgtGetLastMachMgrError()
|
|
|
|
|
-- se mortasatura e l'errore è compatibile (Axes values not calculable) si prova con l'altra configurazione dell'asse bloccato
|
|
|
|
|
-- TODO valutare se c'è modo di capire preventivamente la configurazione dell'asse bloccato e quindi rimuovere questa parte di codice
|
|
|
|
|
if Machining.Type == MCH_OY.MORTISING and nErr == 2507 then
|
|
|
|
|
if Machining.BlockedAxis.Orientation == 'perpendicular' then
|
|
|
|
|
Machining.BlockedAxis.Orientation = 'parallel'
|
|
|
|
|
else
|
|
|
|
|
Machining.BlockedAxis.Orientation = 'perpendicular'
|
|
|
|
|
if Machining.Type == MCH_OY.MORTISING then
|
|
|
|
|
-- se errore "Axes values not calculable" si prova con l'altra configurazione dell'asse bloccato
|
|
|
|
|
if nErr == 2507 then
|
|
|
|
|
if Machining.BlockedAxis.Orientation == 'perpendicular' then
|
|
|
|
|
Machining.BlockedAxis.Orientation = 'parallel'
|
|
|
|
|
else
|
|
|
|
|
Machining.BlockedAxis.Orientation = 'perpendicular'
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( Machining.Name, Machining.BlockedAxis.Orientation, b3Raw, Machining.BlockedAxis.VtN, Machining.BlockedAxis.VtOut))
|
|
|
|
|
if Machining.SuggestedAngles.Index == 1 then
|
|
|
|
|
Machining.SuggestedAngles.Index = 2
|
|
|
|
|
else
|
|
|
|
|
Machining.SuggestedAngles.Index = 1
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( Machining.SuggestedAngles.VtN, Machining.SuggestedAngles.VtOrtho, Machining.SuggestedAngles.Index))
|
|
|
|
|
sErr = ''
|
|
|
|
|
bIsApplyOk = ML.ApplyMachining( true, false)
|
|
|
|
|
-- se errore "Outstroke" e permesso ToolInvert provo ad invertire il lato di lavorazione
|
|
|
|
|
elseif Machining.AllowToolInvert and nErr == 2508 then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, not Machining.ToolInvert)
|
|
|
|
|
sErr = ''
|
|
|
|
|
bIsApplyOk = ML.ApplyMachining( true, false)
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( Machining.Name, Machining.BlockedAxis.Orientation, b3Raw, Machining.BlockedAxis.VtN, Machining.BlockedAxis.VtOut))
|
|
|
|
|
if Machining.SuggestedAngles.Index == 1 then
|
|
|
|
|
Machining.SuggestedAngles.Index = 2
|
|
|
|
|
else
|
|
|
|
|
Machining.SuggestedAngles.Index = 1
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( Machining.SuggestedAngles.VtN, Machining.SuggestedAngles.VtOrtho, Machining.SuggestedAngles.Index))
|
|
|
|
|
sErr = ''
|
|
|
|
|
bIsApplyOk = ML.ApplyMachining( true, false)
|
|
|
|
|
end
|
|
|
|
|
if not bIsApplyOk then
|
|
|
|
|
nErr, sErr = EgtGetLastMachMgrError()
|
|
|
|
@@ -5182,18 +5233,16 @@ function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, Edg
|
|
|
|
|
Cutting.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. SawPlusChain.Name .. ' not applicable - saw blade not found'
|
|
|
|
|
Cutting.CanApply = false
|
|
|
|
|
EgtOutLog( Cutting.Message)
|
|
|
|
|
return Cutting
|
|
|
|
|
end
|
|
|
|
|
Cutting.Type = MCH_OY.MILLING
|
|
|
|
|
Cutting.Tool = SawPlusChain.GetToolFromMachining( Cutting.Name)
|
|
|
|
|
|
|
|
|
|
-- verifica dimensioni tasca compatibili
|
|
|
|
|
-- verifica dimensioni tasca e direzione compatibili
|
|
|
|
|
-- se tasca meno spessa della lama la strategia non è applicabile
|
|
|
|
|
if Cutting.Tool.Thickness > dPocketHeight + 10 * GEO.EPS_SMALL then
|
|
|
|
|
Cutting.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. SawPlusChain.Name .. ' not applicable - pocket too narrow for saw blade thickness'
|
|
|
|
|
Cutting.CanApply = false
|
|
|
|
|
EgtOutLog( Cutting.Message)
|
|
|
|
|
return Cutting
|
|
|
|
|
end
|
|
|
|
|
if #( Proc.MainFaces.SideFaces) > 1 then
|
|
|
|
|
-- se tasca più stretta della lama la strategia non è applicabile
|
|
|
|
@@ -5201,9 +5250,13 @@ function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, Edg
|
|
|
|
|
Cutting.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. SawPlusChain.Name .. ' not applicable - pocket too narrow for saw blade diameter'
|
|
|
|
|
Cutting.CanApply = false
|
|
|
|
|
EgtOutLog( Cutting.Message)
|
|
|
|
|
return Cutting
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if EdgeToMachine.ToolDirection:getZ() < BD.NZ_MINA then
|
|
|
|
|
Cutting.CanApply = false
|
|
|
|
|
Cutting.Message = 'Feature '.. Proc.FeatureId .. ' : skipped sawblade from bottom'
|
|
|
|
|
EgtOutLog( Cutting.Message)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- parametri della lavorazione
|
|
|
|
|
-- inizio e fine aperti o chiusi
|
|
|
|
@@ -5334,6 +5387,7 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
|
|
|
|
|
Mortising.CanApply = true
|
|
|
|
|
Mortising.Message = ''
|
|
|
|
|
Mortising.ProcId = Proc.Id
|
|
|
|
|
Mortising.AllowToolInvert = false
|
|
|
|
|
local bNeedToMachineOtherSide = false
|
|
|
|
|
local dTestCornerRadius = 43
|
|
|
|
|
-- OneSide | OneSideAndExtend | BothSides | BothSidesAndExtend
|
|
|
|
@@ -5377,18 +5431,21 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
|
|
|
|
|
Mortising.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. SawPlusChain.Name .. ' not applicable - chainsaw not found'
|
|
|
|
|
Mortising.CanApply = false
|
|
|
|
|
EgtOutLog( Mortising.Message)
|
|
|
|
|
return Mortising
|
|
|
|
|
end
|
|
|
|
|
Mortising.Type = MCH_OY.MORTISING
|
|
|
|
|
Mortising.Tool = SawPlusChain.GetToolFromMachining( Mortising.Name)
|
|
|
|
|
|
|
|
|
|
-- in caso di tunnel da un lato permetto eventuale inversione lato di lavoro in caso di errori di applicazione (es: Outstroke)
|
|
|
|
|
if Proc.Topology == 'Tunnel' and sMortisingType == 'OneSide' or sMortisingType == 'OneSideAndExtend' then
|
|
|
|
|
Mortising.AllowToolInvert = true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- verifica dimensioni tasca compatibili
|
|
|
|
|
-- se tasca meno spessa della sega a catena la strategia non è applicabile
|
|
|
|
|
if Mortising.Tool.Thickness > dPocketHeight + 10 * GEO.EPS_SMALL then
|
|
|
|
|
Mortising.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. SawPlusChain.Name .. ' not applicable - pocket too narrow for chainsaw thickness'
|
|
|
|
|
Mortising.CanApply = false
|
|
|
|
|
EgtOutLog( Mortising.Message)
|
|
|
|
|
return Mortising
|
|
|
|
|
end
|
|
|
|
|
if #( Proc.MainFaces.SideFaces) > 1 then
|
|
|
|
|
-- se tasca più stretta della sega a catena la strategia non è applicabile
|
|
|
|
@@ -5396,9 +5453,13 @@ function SawPlusChain.Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine
|
|
|
|
|
Mortising.Message = 'Feature '.. Proc.FeatureId .. ' : strategy ' .. SawPlusChain.Name .. ' not applicable - pocket too narrow for chainsaw width'
|
|
|
|
|
Mortising.CanApply = false
|
|
|
|
|
EgtOutLog( Mortising.Message)
|
|
|
|
|
return Mortising
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if EdgeToMachine.ToolDirection:getZ() < - 10 * GEO.EPS_ANG_SMALL then
|
|
|
|
|
Mortising.CanApply = false
|
|
|
|
|
Mortising.Message = 'Feature '.. Proc.FeatureId .. ' : skipped chainsaw from bottom'
|
|
|
|
|
EgtOutLog( Mortising.Message)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- parametri della lavorazione
|
|
|
|
|
-- inizio e fine aperti o chiusi
|
|
|
|
@@ -5555,9 +5616,9 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
|
|
|
|
local bIsCuttingOk = false
|
|
|
|
|
if Cutting.CanApply then
|
|
|
|
|
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
if not bIsCuttingOk then
|
|
|
|
|
return bIsCuttingOk, Cutting.Message
|
|
|
|
|
if not bIsCuttingOk then
|
|
|
|
|
return bIsCuttingOk, Cutting.Message
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local dBottomDepthToMachine = Cutting.RadialOffset
|
|
|
|
|
-- lato opposto del tunnel
|
|
|
|
@@ -5566,9 +5627,9 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
|
|
|
|
bIsCuttingOk = false
|
|
|
|
|
if Cutting.CanApply then
|
|
|
|
|
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
if not bIsCuttingOk then
|
|
|
|
|
return bIsCuttingOk, Cutting.Message
|
|
|
|
|
if not bIsCuttingOk then
|
|
|
|
|
return bIsCuttingOk, Cutting.Message
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
-- se la lama non è arrivata sul fondo e c'è almeno un lato aperto va lavorato
|
|
|
|
@@ -5579,9 +5640,9 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
|
|
|
|
bIsCuttingOk = false
|
|
|
|
|
if Cutting.CanApply then
|
|
|
|
|
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
if not bIsCuttingOk then
|
|
|
|
|
return bIsCuttingOk, Cutting.Message
|
|
|
|
|
if not bIsCuttingOk then
|
|
|
|
|
return bIsCuttingOk, Cutting.Message
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- eventuale lavorazione di lama - lato della tasca in cui finisce la lavorazione
|
|
|
|
@@ -5590,9 +5651,9 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
|
|
|
|
bIsCuttingOk = false
|
|
|
|
|
if Cutting.CanApply then
|
|
|
|
|
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
if not bIsCuttingOk then
|
|
|
|
|
return bIsCuttingOk, Cutting.Message
|
|
|
|
|
if not bIsCuttingOk then
|
|
|
|
|
return bIsCuttingOk, Cutting.Message
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- la lama è arrivata sul fondo e tasca passante, non servono ulteriori lavorazioni
|
|
|
|
@@ -5626,9 +5687,9 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
|
|
|
|
bIsMortisingOk = false
|
|
|
|
|
if Mortising.CanApply then
|
|
|
|
|
bIsMortisingOk, Mortising.Message = SawPlusChain.Chainsaw.ApplyAllSteps( Mortising, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
if not bIsMortisingOk then
|
|
|
|
|
return bIsMortisingOk, Mortising.Message
|
|
|
|
|
if not bIsMortisingOk then
|
|
|
|
|
return bIsMortisingOk, Mortising.Message
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
-- se la sega a catena non è arrivata sul fondo e c'è almeno un lato aperto va lavorato
|
|
|
|
@@ -5639,9 +5700,9 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
|
|
|
|
bIsMortisingOk = false
|
|
|
|
|
if Mortising.CanApply then
|
|
|
|
|
bIsMortisingOk, Mortising.Message = SawPlusChain.Chainsaw.ApplyAllSteps( Mortising, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
if not bIsMortisingOk then
|
|
|
|
|
return bIsMortisingOk, Mortising.Message
|
|
|
|
|
if not bIsMortisingOk then
|
|
|
|
|
return bIsMortisingOk, Mortising.Message
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- eventuale lavorazione di sega a catena - lato della tasca in cui finisce la lavorazione
|
|
|
|
@@ -5650,9 +5711,9 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
|
|
|
|
bIsMortisingOk = false
|
|
|
|
|
if Mortising.CanApply then
|
|
|
|
|
bIsMortisingOk, Mortising.Message = SawPlusChain.Chainsaw.ApplyAllSteps( Mortising, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
if not bIsMortisingOk then
|
|
|
|
|
return bIsMortisingOk, Mortising.Message
|
|
|
|
|
if not bIsMortisingOk then
|
|
|
|
|
return bIsMortisingOk, Mortising.Message
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|