Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8969b8bc9f | |||
| 237fa742fc | |||
| b6ccdd59ea | |||
| b10844beed | |||
| 793aff4ffb | |||
| 3d2d17e11f | |||
| 16c9ac9771 | |||
| ed658fffa6 |
@@ -1662,12 +1662,16 @@ function MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Machining, Part)
|
||||
local idTempGroup = Part.idTempGroup
|
||||
-- TODO in futuro creare flatregion (se ci fossero isole il calcolo del percorso non sarebbe corretto)
|
||||
local idFaceContour = EgtExtractSurfTmFacetLoops( ProcTm.id, Machining.Geometry[1][2], idTempGroup)
|
||||
|
||||
-- si settano i lati aperti della curva derivata dalla superficie
|
||||
local sOpenEdges = ''
|
||||
for i = 1, #ProcTm.Faces[Machining.Geometry[1][2] + 1].Edges do
|
||||
if ProcTm.Faces[Machining.Geometry[1][2] + 1].Edges[i].bIsOpen then
|
||||
EgtCurveCompoSetTempProp( idFaceContour, ProcTm.Faces[Machining.Geometry[1][2] + 1].Edges[i].id, 1)
|
||||
sOpenEdges = sOpenEdges .. EgtNumToString( ProcTm.Faces[Machining.Geometry[1][2] + 1].Edges[i].id) .. ','
|
||||
end
|
||||
end
|
||||
EgtSetInfo( idFaceContour, 'OPEN', sOpenEdges)
|
||||
|
||||
-- dal momento che la funzione EgtPocketing non considera il grezzo, nei casi ottimizzati si deve correggere l'offset
|
||||
local idTestCurve = EgtCopyGlob( idFaceContour, idTempGroup )
|
||||
local bIsOptimizedPocketing = ( TOOLS[Machining.nToolIndex].dDiameter > TOOLS[Machining.nToolIndex].dSideStep - 10 * GEO.EPS_SMALL)
|
||||
@@ -1678,11 +1682,7 @@ function MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Machining, Part)
|
||||
dOffset = TOOLS[Machining.nToolIndex].dDiameter - TOOLS[Machining.nToolIndex].dSideStep
|
||||
end
|
||||
EgtOffsetCurve( idFaceContour, dOffset)
|
||||
-- si settano tutti i lati chiusi per la curva offsettata
|
||||
local _, nFaceCountourCurveCount = EgtCurveDomain( idFaceContour)
|
||||
for i = 1, nFaceCountourCurveCount do
|
||||
EgtCurveCompoSetTempProp( idFaceContour, i - 1, 0)
|
||||
end
|
||||
EgtRemoveInfo( idFaceContour, 'OPEN')
|
||||
end
|
||||
-- calcolo percorso di svuotatura replicando il calcolo che fa la svuotatura
|
||||
local idPocketingPath = EgtPocketing( idFaceContour, TOOLS[Machining.nToolIndex].dDiameter / 2, TOOLS[Machining.nToolIndex].dSideStep, 0, Machining.nSubType, true, idTempGroup)
|
||||
|
||||
@@ -301,6 +301,8 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, idCheckCollisionTm, idAddedCollisionSurfTm)
|
||||
|
||||
local idAddGroup = BeamLib.GetAddGroup( Part.id)
|
||||
|
||||
-- spostamento assi macchina in posizione
|
||||
local dDeltaXHeadOffset = MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux)
|
||||
|
||||
@@ -350,6 +352,12 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
|
||||
end
|
||||
if EgtGetDebugLevel() >= 3 and bCollisionFoundPiece then
|
||||
EgtSetColor( CollisionSurfTmId[i], RED())
|
||||
local idBeamCopy = EgtCopyGlob( idCheckCollisionTm, idAddGroup)
|
||||
EgtSetName( idBeamCopy, 'COLL_BEAM')
|
||||
local idHeadCopy = EgtCopyGlob( CollisionSurfTmId[i], idAddGroup)
|
||||
EgtSetName( idHeadCopy, 'COLL_' .. sAxis)
|
||||
EgtVector( idAddGroup, vtHead, ptOnToolTipCenter, GDB_RT.GLOB)
|
||||
EgtSetStatus( { idBeamCopy, idHeadCopy}, GDB_ST.OFF)
|
||||
end
|
||||
if bCollisionFoundPiece then
|
||||
break
|
||||
@@ -430,8 +438,8 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
|
||||
if bCheckFlange and Tool.sType == 'SAW_FLAT' then
|
||||
local ptCenterFlange = PointsOnToolTipCenter[i] + vtHead * Tool.dThickness
|
||||
local frHead = Frame3d( ptCenterFlange, vtHead)
|
||||
local dExtraSafety = 2 -- valore empirico che serve nei casi molto inclinati, ci potrebbero essere casi in cui va aumentato
|
||||
local idFlangeCurve = EgtCircle( Part.idTempGroup, ORIG(), dExtraSafety + Tool.dDiameter / 2 - Tool.dMaxDepth, GDB_RT.GLOB)
|
||||
local dFlangeRadius = Tool.ToolHolder.dDiameter / 2
|
||||
local idFlangeCurve = EgtCircle( Part.idTempGroup, ORIG(), dFlangeRadius, GDB_RT.GLOB)
|
||||
EgtTransform( idFlangeCurve, frHead, GDB_RT.GLOB)
|
||||
|
||||
-- TODO verificare se questo controllo serve
|
||||
|
||||
@@ -358,8 +358,8 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters)
|
||||
end
|
||||
|
||||
|
||||
local function SetDiceFaceInfo( Proc, idDiceFace)
|
||||
EgtSetName( idDiceFace, 'Face' .. tostring( Proc.idFeature or 'Add') .. '_Dice')
|
||||
local function SetDiceFaceInfo( Proc, idDiceFace, sType)
|
||||
EgtSetName( idDiceFace, 'Face' .. tostring( Proc.idFeature or 'Add') .. '_Dice_' .. sType)
|
||||
end
|
||||
|
||||
|
||||
@@ -770,7 +770,7 @@ local function CutWholeWaste( Proc, Part, OptionalParameters)
|
||||
Result.dQuality = FeatureLib.GetStrategyQuality( Machinings)
|
||||
-- per tagli con lati brutti o ghigliottina si abbassa la qualità
|
||||
if ( sChosenBladeType ~= 'Top') and ( sChosenBladeType ~= 'Bottom') then
|
||||
Result.dQuality = FeatureLib.GetStrategyQuality( 'STD')
|
||||
Result.dQuality = FeatureLib.GetStrategyQuality( 'FINE')
|
||||
end
|
||||
Result.dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Machinings)
|
||||
Result.dMRR = ( FeatureInfo.dFeatureVolume / Result.dTimeToMachine) / pow( 10, 6)
|
||||
@@ -782,47 +782,30 @@ local function CutWholeWaste( Proc, Part, OptionalParameters)
|
||||
end
|
||||
|
||||
|
||||
-- TODO da rivedere!! Si devono creare trimesh estruse nelle direzioni normali alle due facce, unirle e poi sottrarle al solido
|
||||
-- nel modo attuale funziona solo se i cubetti sono orientati come le direzioni principali
|
||||
local function UpdateDiceRaw( idRaw, idParallelTm, idPerpendicularTm, Part, MainFace, OtherFace)
|
||||
local function UpdateDiceRaw( idRaw, idParallelTm, idPerpendicularTm, Part)
|
||||
|
||||
-- frame solidale alla feature
|
||||
local vtZ = MainFace.vtN
|
||||
local vtX = OtherFace and OtherFace.vtN or nil
|
||||
local frMainFace = Frame3d( MainFace.ptCenter, vtZ, vtX)
|
||||
-- contorno della faccia parallela
|
||||
local vtNParallelFaceTm = EgtSurfTmFacetNormVersor( idParallelTm, 0, GDB_ID.ROOT)
|
||||
local idParallelFaceCurveCompo = EgtExtractSurfTmLoops( idParallelTm, Part.idTempGroup)
|
||||
EgtModifyCurveExtrusion( idParallelFaceCurveCompo, vtNParallelFaceTm, GDB_RT.GLOB)
|
||||
EgtOffsetCurve( idParallelFaceCurveCompo, 100, GDB_OT.EXTEND)
|
||||
|
||||
-- box del cubetto in riferimento feature
|
||||
local b3Surf = EgtGetBBoxRef( idParallelTm, GDB_BB.STANDARD, frMainFace)
|
||||
-- trimesh da sottrarre, tagliata con il piano perpendicolare
|
||||
local vtExtrusion = 1000 * vtNParallelFaceTm
|
||||
local idSurfTmToSubtract = EgtSurfTmByRegionExtrusion( Part.idTempGroup, idParallelFaceCurveCompo, vtExtrusion, 0.05, GDB_RT.GLOB)
|
||||
if idPerpendicularTm then
|
||||
local b3SurfPerpendicular = EgtGetBBoxRef( idPerpendicularTm, GDB_BB.STANDARD, frMainFace)
|
||||
b3Surf:Add( b3SurfPerpendicular)
|
||||
else
|
||||
-- se non arriva la superficie perpendicolare è un solo taglio parallelo: si estende il box in Z in modo da uscire dal pezzo
|
||||
local ptDeltaZ = b3Surf:getMax() + vtZ * ( MainFace.dElevation + 5)
|
||||
b3Surf:Add( ptDeltaZ)
|
||||
local ptCenterPerpendicularTm, vtNPerpendicularTm = EgtSurfTmFacetCenter( idPerpendicularTm, 0, GDB_ID.ROOT)
|
||||
EgtCutSurfTmPlane( idSurfTmToSubtract, ptCenterPerpendicularTm, -vtNPerpendicularTm, false, GDB_RT.GLOB)
|
||||
-- dove la trimesh è stata tagliata mancherà la faccia: si riaggiunge
|
||||
local idRemovedFaceCurveCompo = EgtExtractSurfTmLoops( idSurfTmToSubtract, Part.idTempGroup)
|
||||
local idRemovedFaceTm = EgtSurfTmByFlatContour( Part.idTempGroup, idRemovedFaceCurveCompo)
|
||||
local vtNRemovedFace = EgtSurfTmFacetNormVersor( idRemovedFaceTm, 0, GDB_ID.ROOT)
|
||||
if AreSameVectorApprox( vtNPerpendicularTm, vtNRemovedFace) then
|
||||
EgtInvertSurf( idRemovedFaceTm)
|
||||
end
|
||||
idSurfTmToSubtract = EgtSurfTmBySewing( Part.idTempGroup, { idSurfTmToSubtract, idRemovedFaceTm})
|
||||
end
|
||||
|
||||
-- estensione box per non avere problemi nella sottrazione booleana
|
||||
if OtherFace and idPerpendicularTm then
|
||||
local vtY = vtZ ^ vtX
|
||||
local ptDeltaX = b3Surf:getMax() + vtX * 1
|
||||
local ptDeltaZ = b3Surf:getMax() + vtZ * 1
|
||||
local ptDeltaYplus = b3Surf:getMax() + vtY * 1
|
||||
local ptDeltaYminus = b3Surf:getMin() - vtY * 1
|
||||
b3Surf:Add( ptDeltaX)
|
||||
b3Surf:Add( ptDeltaZ)
|
||||
b3Surf:Add( ptDeltaYplus)
|
||||
b3Surf:Add( ptDeltaYminus)
|
||||
else
|
||||
b3Surf:expand( 1)
|
||||
end
|
||||
|
||||
-- si porta il box in riferimento globale
|
||||
b3Surf:toGlob( frMainFace)
|
||||
|
||||
-- conversione box cubetto in superficie
|
||||
local idSurfTmToSubtract = EgtSurfTmBBox( Part.idTempGroup, b3Surf, false, GDB_RT.GLOB)
|
||||
|
||||
-- sottrazione del cubetto dal grezzo
|
||||
EgtSurfTmSubtract( idRaw, idSurfTmToSubtract)
|
||||
|
||||
@@ -858,7 +841,8 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
||||
local bAreOrthogonalCutsInverted = false
|
||||
for i = 1, #vCuts do
|
||||
for j = 1, #vCuts[i] do
|
||||
SetDiceFaceInfo( Proc, vCuts[i][j])
|
||||
local sType = ( i % 2 == 0) and 'Paral' or 'Perp'
|
||||
SetDiceFaceInfo( Proc, vCuts[i][j], sType)
|
||||
end
|
||||
end
|
||||
-- calcolo lavorazioni
|
||||
@@ -924,7 +908,7 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
||||
end
|
||||
-- aggiornamento grezzo dinamico
|
||||
if i % 2 == 0 then
|
||||
UpdateDiceRaw( idCheckCollisionTm, idSurfToCut, vCuts[i-1][#vCuts[i-1]], Part, MainFace, OtherFace)
|
||||
UpdateDiceRaw( idCheckCollisionTm, idSurfToCut, nil, Part)
|
||||
end
|
||||
else
|
||||
EgtErase( idSurfToCut)
|
||||
@@ -988,7 +972,7 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
||||
end
|
||||
-- aggiornamento grezzo dinamico
|
||||
if i % 2 == 0 then
|
||||
UpdateDiceRaw( idCheckCollisionTm, vCuts[i][j], vCuts[i-1][j], Part, MainFace, OtherFace)
|
||||
UpdateDiceRaw( idCheckCollisionTm, vCuts[i][j], vCuts[i-1][j], Part)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -603,14 +603,15 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
-- TODO già guardare se il box della faccia è aperto sulla coda, invece di tutta la trimesh, escluderebbe tanti casi
|
||||
Cutting.bMoveAfterSplit = Cutting.bMoveAfterSplit or Cutting.LeadIn.bMoveAfterSplit or Cutting.LeadOut.bMoveAfterSplit
|
||||
local bIsTruncatingCutOnTail = Proc.Topology and ( Proc.Topology.sName == 'Cut-1-Through' or Proc.Topology.sName == 'TailCut') and Proc.AffectedFaces.bLeft
|
||||
if Cutting.bMoveAfterSplit or bIsTruncatingCutOnTail then
|
||||
local bIsFeatureBigAsRawOnTail = ( Proc.b3Box:getDimY() > Part.b3Raw:getDimY() - 100 * GEO.EPS_SMALL) and
|
||||
( Proc.b3Box:getDimZ() > Part.b3Raw:getDimZ() - 100 * GEO.EPS_SMALL) and
|
||||
Proc.AffectedFaces.bLeft
|
||||
if Cutting.bMoveAfterSplit or bIsTruncatingCutOnTail or bIsFeatureBigAsRawOnTail then
|
||||
Cutting.sStage = 'AfterTail'
|
||||
elseif Proc.AffectedFaces.bLeft and
|
||||
( EdgeToMachine.sType == 'Bottom' or
|
||||
( Cutting.vtToolDirection:getX() < 0.707 and
|
||||
not ( Cutting.vtToolDirection:getX() > - 10 * GEO.EPS_SMALL and
|
||||
( AreSameOrOppositeVectorApprox( EdgeToMachine.vtEdge, Z_AX()) or
|
||||
AreSameOrOppositeVectorApprox( EdgeToMachine.vtEdge, Y_AX()))))) then
|
||||
( Cutting.vtToolDirection:getX() < 0.707 and not ( Cutting.vtToolDirection:getX() > - 10 * GEO.EPS_SMALL and ( AreSameOrOppositeVectorApprox( EdgeToMachine.vtEdge, Z_AX()) or
|
||||
AreSameOrOppositeVectorApprox( EdgeToMachine.vtEdge, Y_AX()))))) then
|
||||
|
||||
local dLengthOnX = Cutting.dLengthOnX
|
||||
-- se feature splittata non si considera la lunghezza della feature per il check spostamento dopo separazione
|
||||
|
||||
Reference in New Issue
Block a user