DataWall :
- migliorie a nesting - aggiunta gestione prefori - migliorie a rifinitura tagli inclinati.
This commit is contained in:
+95
-33
@@ -136,7 +136,8 @@ local function CreateToolRectangle( ptP1, dValP1, ptP2, dValP2, vtFace, dValFace
|
||||
ptP1 = ptP1 - vtX * ( dValP1 + dExtra)
|
||||
ptP2 = ptP2 + vtX * ( dValP2 + dExtra)
|
||||
ptP2 = ptP2 + vtFace * ( dValFace + dExtra)
|
||||
local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0))
|
||||
--local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0))
|
||||
local nId = EgtRectangle2P( nOutlineGrp, ptP2, ptP1)
|
||||
return nId
|
||||
end
|
||||
|
||||
@@ -282,10 +283,12 @@ local function IdentifyLJFromTop( Proc, bCompute, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
|
||||
-- caso 3 facce forma ad U
|
||||
elseif Proc.Fct == 3 and NEST.LAP_JOINT_U_MACH_AREA == 1 then
|
||||
-- caso 3 facce
|
||||
elseif Proc.Fct == 3 then
|
||||
local nFacInd, dElev, nFacInd2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
|
||||
if not nFacInd2 and nFacInd ~= GDB_ID.NULL then
|
||||
|
||||
-- forma ad U
|
||||
if not nFacInd2 and nFacInd ~= GDB_ID.NULL and NEST.LAP_JOINT_U_MACH_AREA == 1 then
|
||||
local vtFace = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
if vtFace:getZ() > dMinComp then
|
||||
bLJFromTop = true
|
||||
@@ -297,9 +300,49 @@ local function IdentifyLJFromTop( Proc, bCompute, nOutlineGrp)
|
||||
local dVal = WD.SIDEMILL_DIAM_UP / 2 + 5
|
||||
local ptMin = b3Face:getMin() - dVal * vtDir
|
||||
local ptMax = b3Face:getMax() + dVal * vtDir
|
||||
nRectId = EgtRectangle2P( nOutlineGrp, Point3d(ptMax:getX(), ptMax:getY(), 0), Point3d( ptMin:getX(), ptMin:getY(), 0))
|
||||
-- nRectId = EgtRectangle2P( nOutlineGrp, Point3d(ptMax:getX(), ptMax:getY(), 0), Point3d( ptMin:getX(), ptMin:getY(), 0))
|
||||
nRectId = EgtRectangle2P( nOutlineGrp, ptMax, ptMin)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
elseif nFacInd2 then
|
||||
local nFaceZ = -1
|
||||
for nIdx = 0, 2 do
|
||||
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, nIdx, GDB_ID.ROOT)
|
||||
if vtN2:getZ() > dMinComp then
|
||||
nFaceZ = nIdx
|
||||
break
|
||||
end
|
||||
end
|
||||
if nFaceZ ~= -1 then
|
||||
local nFace = EgtIf( nFaceZ == nFacInd, nFacInd2, nFacInd)
|
||||
local nOtherFace = EgtIf( nFaceZ + nFace == 3, 0, EgtIf( nFaceZ + nFace == 2, 1, 2))
|
||||
local vtFace = {}
|
||||
vtFace[1] = EgtSurfTmFacetNormVersor( Proc.Id, nFace, GDB_ID.ROOT)
|
||||
vtFace[2] = EgtSurfTmFacetNormVersor( Proc.Id, nOtherFace, GDB_ID.ROOT)
|
||||
bLJFromTop = true
|
||||
if bCompute then
|
||||
local bAdj, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFace, nFaceZ, GDB_ID.ROOT)
|
||||
local bAdj2, ptP3, ptP4 = EgtSurfTmFacetsContact( Proc.Id, nFace, nOtherFace, GDB_ID.ROOT)
|
||||
if AreSamePointApprox( ptP2, ptP3) or AreSamePointApprox( ptP2, ptP4) then
|
||||
ptP1, ptP2 = ptP2, ptP1
|
||||
end
|
||||
|
||||
local b3Face = EgtSurfTmGetFacetBBoxGlob( Proc.Id, nFaceZ, GDB_BB.STANDARD)
|
||||
local dDim = 0
|
||||
if vtFace[1]:getX() > dMinComp or vtFace[1]:getX() < - dMinComp then
|
||||
dDim = b3Face:getDimX()
|
||||
elseif vtFace[1]:getY() > dMinComp or vtFace[1]:getY() < - dMinComp then
|
||||
dDim = b3Face:getDimY()
|
||||
end
|
||||
local dValFace = max( dDim + WD.SIDEMILL_DIAM_UP / 2, WD.SIDEMILL_DIAM_UP)
|
||||
local dVal = WD.SIDEMILL_DIAM_UP / 2
|
||||
if NEST.MACH_AREA_USE_OTHER_DIAM == 1 then
|
||||
dVal = NEST.MACH_AREA_OTHER_DIAM / 2
|
||||
end
|
||||
nRectId = CreateToolRectangle( ptP1, 0, ptP2, dVal, vtFace[1], dValFace, nOutlineGrp)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -366,7 +409,8 @@ local function ComputeToolOutlines( nPartId)
|
||||
ptP1 = ptP1 - ( WD.MAX_WIDTH - dLen + dExtra) * Y_AX()
|
||||
ptP2 = ptP2 + ( WD.MAX_WIDTH - dLen + dExtra) * Y_AX()
|
||||
|
||||
local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0))
|
||||
--local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0))
|
||||
local nId = EgtRectangle2P( nOutlineGrp, ptP2, ptP1)
|
||||
EgtSetColor( nId, EgtStdColor("AQUA"))
|
||||
if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end
|
||||
end
|
||||
@@ -375,32 +419,50 @@ local function ComputeToolOutlines( nPartId)
|
||||
-- lati inclinati free contour
|
||||
if FreeContour.Identify( Proc) then
|
||||
for nInd = 0, Proc.Fct - 1 do
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nInd, GDB_ID.ROOT)
|
||||
-- se inclinato verso il basso
|
||||
if vtN:getZ() < - GEO.EPS_SMALL then
|
||||
local bLeftOrRightFace = abs( vtN:getX()) > GEO.EPS_SMALL
|
||||
local bFrontOrBackFace = abs( vtN:getY()) > GEO.EPS_SMALL
|
||||
if ( bLeftOrRightFace ~= bFrontOrBackFace) then
|
||||
local vtMainDir = EgtIf( bLeftOrRightFace, X_AX(), Y_AX())
|
||||
local vtOtherDir = EgtIf( bLeftOrRightFace, Y_AX(), X_AX())
|
||||
local dCosAlpha = vtN * vtMainDir
|
||||
local dVal = ( NEST.OFFSET + 0.1) / dCosAlpha
|
||||
local b3Face = EgtSurfTmGetFacetBBoxGlob( Proc.Id, nInd, GDB_BB.STANDARD)
|
||||
local dDim = EgtIf( bLeftOrRightFace, b3Face:getDimY(), b3Face:getDimX())
|
||||
local ptP1
|
||||
if ( dCosAlpha < 0) then
|
||||
ptP1 = b3Face:getMin()
|
||||
else
|
||||
ptP1 = b3Face:getMax()
|
||||
dDim = -1 * dDim
|
||||
end
|
||||
|
||||
local ptP2 = ptP1 + dVal * vtMainDir + dDim * vtOtherDir
|
||||
local nRectId = EgtRectangle2P( nOutlineGrp, Point3d(ptP1:getX(), ptP1:getY(), 0), Point3d( ptP2:getX(), ptP2:getY(), 0))
|
||||
EgtSetColor( nRectId, EgtStdColor("AQUA"))
|
||||
if nRectId ~= GDB_ID.NULL then table.insert( ToolOutlineId, nRectId) end
|
||||
end
|
||||
end
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nInd, GDB_ID.ROOT)
|
||||
-- se inclinato
|
||||
if abs( vtN:getZ()) > GEO.EPS_SMALL then
|
||||
local bUnderCut = vtN:getZ() < - GEO.EPS_SMALL
|
||||
|
||||
local frRect = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nInd, GDB_ID.ROOT)
|
||||
local vtX = frRect:getVersX()
|
||||
local vtY = Z_AX() ^ vtX
|
||||
local frLoc = Frame3d( ORIG(), vtX, vtY, Z_AX())
|
||||
vtN:toLoc( frLoc)
|
||||
|
||||
local dCosAlpha = vtN * Y_AX()
|
||||
local dVal
|
||||
if bUnderCut then
|
||||
dVal = ( NEST.OFFSET + 0.1) / dCosAlpha
|
||||
else
|
||||
dVal = ( NEST.OFFSET + 0.1) * dCosAlpha
|
||||
end
|
||||
|
||||
local b3Face = EgtSurfTmGetFacetBBoxRef( Proc.Id, nInd, GDB_BB.STANDARD, frLoc)
|
||||
local dExtra = NEST.OFFSET / 2
|
||||
local dDim = b3Face:getDimX() + 2 * dExtra
|
||||
|
||||
local dCoordZ = EgtIf( bUnderCut, b3Face:getDimZ(), 0)
|
||||
local ptP1
|
||||
if ( dCosAlpha < 0) then
|
||||
ptP1 = Point3d( b3Face:getMin():getX(), b3Face:getMin():getY(), dCoordZ)
|
||||
else
|
||||
ptP1 = Point3d( b3Face:getMax():getX(), b3Face:getMax():getY(), dCoordZ)
|
||||
dDim = -1 * dDim
|
||||
dExtra = -1 * dExtra
|
||||
end
|
||||
|
||||
ptP1 = ptP1 - dExtra * X_AX()
|
||||
local ptDir = ptP1 + dDim * X_AX()
|
||||
local ptCross = ptDir + dVal * Y_AX()
|
||||
ptP1:toGlob( frLoc)
|
||||
ptDir:toGlob( frLoc)
|
||||
ptCross:toGlob( frLoc)
|
||||
local nRectId = EgtRectangle3P( nOutlineGrp, ptP1, ptCross, ptDir)
|
||||
EgtSetColor( nRectId, EgtStdColor("AQUA"))
|
||||
if nRectId ~= GDB_ID.NULL then table.insert( ToolOutlineId, nRectId) end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user