Compare commits
4 Commits
main
...
DiceRawFix
| Author | SHA1 | Date | |
|---|---|---|---|
| 793aff4ffb | |||
| 3d2d17e11f | |||
| 16c9ac9771 | |||
| ed658fffa6 |
@@ -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,11 @@ 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)
|
||||
end
|
||||
if bCollisionFoundPiece then
|
||||
break
|
||||
@@ -430,8 +437,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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
-- 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
|
||||
|
||||
Reference in New Issue
Block a user