DataWall :

- modifiche per forature orizzontali lunghe da dividere in due parti
- corretta gestione mortasature passanti
- modifiche a nesting
- in FreeContour penna e chiodatura sempre riportate sulla superficie sopra.
This commit is contained in:
DarioS
2021-11-15 10:15:35 +01:00
parent 340f43bd01
commit d6e3cbfc26
8 changed files with 166 additions and 78 deletions
+61 -53
View File
@@ -134,28 +134,15 @@ local function NewMachGroupName()
return nMaxMachGroup + 1
end
-- Funzione che crea
local function CreateToolRectangle( ptP1, ptP2, vtFace, nOutlineGrp)
-- da inserire in WallData
local MILL_DIAM = 350
local vtX = ptP2 - ptP1
vtX:normalize()
-- creo il rettangolo della lavorazione
ptP1 = ptP1 - vtX * 9000
ptP2 = ptP2 + vtX * ( MILL_DIAM / 2 + 100 * GEO.EPS_SMALL)
ptP2 = ptP2 + vtFace * ( MILL_DIAM + 100 * GEO.EPS_SMALL)
local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0))
return nId
end
-- Funzione che crea le regioni occupate dalle lavorazioni
local function ComputeToolOutlines( nPartId)
local function CreateToolOutlines( nPartId, b3Raw)
-- da inserire in WallData
local MILL_DIAM = 350
local MILL_MAX_MAT = 115
-------------------------------------
local ToolOutlineId = {}
-- recupero il gruppo con gli outlines degli utensili
@@ -179,27 +166,50 @@ local function ComputeToolOutlines( nPartId)
if ( vtN[1]:getZ() <= - 0.95 or vtN[2]:getZ() <= - 0.95) then
local vtFace = EgtIf( vtN[1]:getZ() <= -0.95, vtN[2], vtN[1])
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, 0, 1, GDB_ID.ROOT)
local vtX = ptP2 - ptP1
vtX:normalize()
-- creo il rettangolo della lavorazione
local nId = CreateToolRectangle( ptP1, ptP2, vtFace, nOutlineGrp)
ptP1 = ptP1 - vtX * 9000
ptP2 = ptP2 + vtX * ( MILL_DIAM / 2 + 100 * GEO.EPS_SMALL)
ptP2 = ptP2 + vtFace * ( MILL_DIAM + 100 * GEO.EPS_SMALL)
local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0))
if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end
end
end
if Proc.Fct == 3 then
local nFacInd, dElev = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
if nFacInd ~= -2 then
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
if not AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
local nOtherFace = EgtIf( nFacInd == 0, 1, 0)
local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nOtherFace, GDB_ID.ROOT)
if abs( ptP1:getZ() - ptP2:getZ()) < GEO.EPS_SMALL then
local nId = CreateToolRectangle( ptP1, ptP2, vtN, nOutlineGrp)
if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end
end
if Proc.Fct >= 3 then
LapJoint.Classify( Proc, b3Raw)
if Proc.Stype == 1 or Proc.Stype == 2 then
-- cerco la faccia con il maggior numero di adiacenze
local nFacInd, dElev, nFacInd2, dElev2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
-- se necessario scambio le facce
if Proc.Stype == 2 then
nFacInd, dElev, nFacInd2, dElev2 = nFacInd2, dElev2, nFacInd, dElev
end
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
-- se di fianco e lavorabile con fresa
if vtN:getZ() < WD.NZ_MINA and dElev < MILL_DIAM / 2 - 30 and MILL_MAX_MAT >= min( dH, dV) + 20 * GEO.EPS_SMALL then
local nOtherFace
for nInd = 0, Proc.Fct - 1 do
local vt = EgtSurfTmFacetNormVersor( Proc.Id, nInd, GDB_ID.ROOT)
if abs( vt:getZ()) > 0.8 then nOtherFace = nInd end
end
local bAdj, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFacInd, nOtherFace or GDB_ID.NULL, GDB_ID.ROOT)
if bAdj then
local vtX = ptP2 - ptP1
vtX:normalize()
-- creo il rettangolo della lavorazione
ptP1 = ptP1 - vtX * ( MILL_DIAM / 2 + 100 * GEO.EPS_SMALL)
ptP2 = ptP2 + vtX * ( MILL_DIAM / 2 + 100 * GEO.EPS_SMALL)
ptP2 = ptP2 + vtN * 9000
local nId = EgtRectangle2P( nOutlineGrp, Point3d(ptP2:getX(), ptP2:getY(), 0), Point3d( ptP1:getX(), ptP1:getY(), 0))
if nId ~= GDB_ID.NULL then table.insert(ToolOutlineId, nId) end
end
end
end
end
end
end
end
end
@@ -207,6 +217,7 @@ local function ComputeToolOutlines( nPartId)
end
-- Funzione che sposta e aggiunge pezzi per nesting
local function AddRawParts(RawParts)
-- creo tabella dei grezzi
@@ -249,6 +260,7 @@ local function AddParts(RawParts)
nPartIndex = nPartIndex + 1
-- calcolo bbox pezzo per rotazioni
local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.STANDARD)
local b3Raw = b3Part
local vPartProc = WE.CollectFeatures( nPartId, b3Raw)
-- verifico se possibile flip parete
-- recupero stati di flip delle feature di lavorazione della parete
@@ -345,8 +357,8 @@ local function AddParts(RawParts)
local dPartL = b3Part:getDimX()
local dPartW = b3Part:getDimY()
local nOut0 = 0 -- numero di grezzi che non conterrebbero il pezzo ruotato di 0°/180°
local nOut90 = 0 -- numero di grezzi che non conterrebbero il pezzo ruotato di 90°/270°
local nOut0 = 0 -- grezzi che non conterrebbero il pezzo ruotato di 0°/180°
local nOut90 = 0 -- grezzi che non conterrebbero il pezzo ruotato di 90°/270°
for nInd = 1, #RawParts do
if ( dPartL > RawParts[nInd]["Len"] or dPartW > RawParts[nInd]["Width"]) then nOut0 = nOut0 + 1 end
if ( dPartW > RawParts[nInd]["Len"] or dPartL > RawParts[nInd]["Width"]) then nOut90 = nOut90 + 1 end
@@ -431,7 +443,6 @@ local function AddParts(RawParts)
else
nRotate = 0
end
-- eseguo rotazione se necessario
if nRotate > 0 then
EgtRotate( nPartId, b3Part:getCenter(), Z_AX(), nRotate, GDB_RT.GLOB)
@@ -465,6 +476,7 @@ local function AddParts(RawParts)
table.insert( PartStates, { PartId = tonumber(nPartId), Flip = bFlip, Rotate = nRotate})
-- local bFtDown = false
-- local vPartProc = WE.CollectFeatures( nPartId, b3Raw)
-- for nInd = 1, #vPartProc do
@@ -685,18 +697,14 @@ local function AddParts(RawParts)
end
]]--
if nOutline then
-- aggiungo pezzo al nesting
EgtAutoNestAddPart( nPartId, nOutline, false, bRotNest, nStepRotNest, 0, nCount)
EgtAutoNestAddPart( nPartId, nOutline, false, bRotNest, nStepRotNest, 0, nCount)
-- EgtAutoNestAddPart( PartId, OutlineId, bCanFlip, bCanRotate, dRotStep, nPriority, nCount)
end
-- aggiungo aree di lavorazione del pezzo
local nToolOutlineIds = ComputeToolOutlines( nPartId)
local nToolOutlineIds = CreateToolOutlines( nPartId, b3Raw)
for nInd = 1, #nToolOutlineIds do
EgtAutoNestAddToolOutlineToPart( nPartId, nToolOutlineIds[nInd])
end
@@ -755,7 +763,7 @@ if bOk then
EgtAutoNestSetInterpartGap(NEST.OFFSET)
-- Impostazione corner di inizio del nesting (NST_CORNER.BL, TL, BR, TR)
EgtAutoNestSetStartCorner( NST_CORNER.BR)
EgtAutoNestSetStartCorner( NST_CORNER.TL)
-- imposto tempo di nesting e lo avvio
EgtAutoNestCompute(true, NEST.TIME)
@@ -807,6 +815,9 @@ if bNestingOk then
EgtSetInfo(nMachGroup, "PANELWIDTH", RawParts[nIndex].Width)
EgtSetInfo(nMachGroup, "MATERIAL", RawParts[nIndex].Material)
EgtSetInfo(nMachGroup, "AUTONEST", 1)
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
EgtSetInfo( nMachGroup, "PATTID", nMachGroup)
end
end
nPartCount = 0
@@ -819,7 +830,6 @@ if bNestingOk then
local nPartDuploId = EgtDuploNew( nId)
-- applico flip e rotazioni fatte durante verifica posizionamento pezzo
local b3Part = EgtGetBBoxGlob( nPartDuploId, GDB_BB.STANDARD)
local nPartInd
for nInd = 1, #PartStates do
if PartStates[nInd].PartId == nId then
if PartStates[nInd].Flip then
@@ -828,7 +838,6 @@ if bNestingOk then
if PartStates[nInd].Rotate and PartStates[nInd].Rotate > 0 then
EgtRotate( nPartDuploId, b3Part:getCenter(), Z_AX(), PartStates[nInd].Rotate, GDB_RT.GLOB)
end
nPartInd = nInd
end
end
-- applico rotazione e traslazione pezzo da nesting
@@ -836,11 +845,11 @@ if bNestingOk then
EgtMove( nPartDuploId, Vector3d( dX, dY, 0), GDB_RT.GLOB)
local PartBBox = EgtGetBBoxGlob( nPartDuploId, GDB_BB.STANDARD)
local ptPos = Point3d( PartBBox:getMin():getX(), PartBBox:getMin():getY(), 0)
EgtSetInfo( nMachGroup, "PART" .. nPartCount, nPartDuploId .. "," .. EgtNumToString( ptPos:getX(), 3) .. "," .. EgtNumToString( ptPos:getY(), 3) .. "," .. 0 .."," .. 0)
EgtSetInfo( nMachGroup, "PART" .. nPartCount, nPartDuploId .. "," .. EgtNumToString( ptPos:getX(), 3) .. "," .. EgtNumToString( ptPos:getY(), 3) .. "," .. 0 .. "," .. 0)
EgtSetInfo( nPartDuploId, "POSX", ptPos:getX())
EgtSetInfo( nPartDuploId, "POSY", ptPos:getY())
EgtSetInfo( nPartDuploId, "ROT", dAngRot + PartStates[nPartInd].Rotate)
EgtSetInfo( nPartDuploId, "FLIP", PartStates[nPartInd].Flip)
EgtSetInfo( nPartDuploId, "ROT", dAngRot)
EgtSetInfo( nPartDuploId, "FLIP", 0)
end
end
end
@@ -872,11 +881,10 @@ end
EgtResetCurrMachGroup()
-- cancello rettangolo del materiale per nesting
for RawPartId = 1, #RawParts do
for RawPartId = 1, #RawParts do
EgtErase(RawParts[RawPartId].PartId)
end
end
local nOutlineGrp = EgtGetFirstNameInGroup(GDB_ID.ROOT, "ToolOutlines")
if nOutlineGrp and nOutlineGrp ~= GDB_ID.NULL then EgtErase( nOutlineGrp) end