3dPrinting :

- corretto rilevamento dell'intersezione fra setti.
This commit is contained in:
SaraP
2022-12-27 12:21:30 +01:00
parent 5e3def88fa
commit d7b5d7d16d
2 changed files with 22 additions and 16 deletions
+21 -15
View File
@@ -469,7 +469,7 @@ local function ComputeTrimSurfWithOverlapsForRibs( vIds, nSrfBase, nSrfExt, dOff
end
--------------------------------------------------------------------
local function VerifyRibsIntersection( nRib1, nRib2, nType1, nType2, nSrf1, nSrf2, nGrp, nOffsGrp)
local function VerifyRibsIntersection( nRib1, nRib2, nType1, nType2, nSrf1, nSrf2, dWidth, nGrp, nOffsGrp)
-- setti interni ed esterni non si possono intersecare per definizione
if ( nType1 == RIB_TYPE.INTERNAL and nType2 == RIB_TYPE.EXTERNAL) or ( nType1 == RIB_TYPE.EXTERNAL and nType2 == RIB_TYPE.INTERNAL) then
@@ -490,22 +490,23 @@ local function VerifyRibsIntersection( nRib1, nRib2, nType1, nType2, nSrf1, nSrf
ptInt = EgtIP( nCrv1, nCrv2, ORIG(), GDB_ID.ROOT)
-- se non si intersecano, verifico se si intersecano i loro offset
local bFound = false
if not ptInt then
local bFound = false
local vOffs1 = EgtGetNameInGroup( nOffsGrp, EgtGetName( nCrv1))
local vOffs2 = EgtGetNameInGroup( nOffsGrp, EgtGetName( nCrv2))
for i = 1, #vOffs1 do
local nOffs1 = EgtCopyGlob( vOffs1[i], nGrp)
for j = 1, #vOffs2 do
-- porto nel gruppo locale e verifico se intersezione
local nOffs2 = EgtCopyGlob( vOffs2[j], nGrp)
ptInt = EgtIP( nOffs1, nOffs2, ORIG(), GDB_ID.ROOT)
if ptInt then
bFound = true
break
local nSrfOffs1 = EgtSurfFrFatCurve( nGrp, vOffs1[i], dWidth, false)
if nSrfOffs1 then
for j = 1, #vOffs2 do
-- verifico se intersezione
local nRes = EgtCurveWithRegionClassify( vOffs2[j], nSrfOffs1)
if nRes == GDB_CRC.IN or nRes == GDB_CRC.INTERS then
bFound = true
break
end
end
if bFound then break end
end
if bFound then break end
end
end
@@ -522,6 +523,8 @@ local function VerifyRibsIntersection( nRib1, nRib2, nType1, nType2, nSrf1, nSrf
-- nel caso unbounded l'intersezione può essere ovunque
bInters = true
end
else
bInters = bFound
end
return bInters, ptInt
@@ -655,12 +658,15 @@ local function HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPa
for j = i + 1, #vRibsIds do
local nType2 = EgtGetInfo( vRibsIds[j], KEY_RIBS_TYPE, 'i')
local bRibInters, ptInt = VerifyRibsIntersection( vRibsIds[i], vRibsIds[j], nType1, nType2, nSrfOffs1, nSrfOffs2, nGrpTmp, nOffsGrp)
local bRibInters, ptInt = VerifyRibsIntersection( vRibsIds[i], vRibsIds[j], nType1, nType2, nSrfOffs1, nSrfOffs2, 0.5 * LayerParams.dStrand, nGrpTmp, nOffsGrp)
if bRibInters then
bInters = true
local dPar1 = EgtCurveParamAtPoint( vRibsIds[i], ptInt, GEO.EPS_SMALL, GDB_RT.GLOB)
local dPar2 = EgtCurveParamAtPoint( vRibsIds[j], ptInt, GEO.EPS_SMALL, GDB_RT.GLOB)
local dPar1, dPar2
if ptInt then
dPar1 = EgtCurveParamAtPoint( vRibsIds[i], ptInt, GEO.EPS_SMALL, GDB_RT.GLOB)
dPar2 = EgtCurveParamAtPoint( vRibsIds[j], ptInt, GEO.EPS_SMALL, GDB_RT.GLOB)
end
local _, dParE1 = EgtCurveDomain( vRibsIds[i])
local _, dParE2 = EgtCurveDomain( vRibsIds[j])
+1 -1
View File
@@ -931,7 +931,7 @@ local function CalcRibsToolPath( nRibsGrp, nTpathGrpId, LayerParams, dCorrZ)
-- mi sposto dell'altezza layer
EgtMove( nNewEntId, LayerParams.dLayHeight * LayerParams.vtSlicing, GDB_RT.GLOB)
EgtModifyCurveExtrusion( nNewEntId, LayerParams.vtSlicing, GDB_RT.GLOB)
-- EgtSetColor( nNewEntId, EgtStdColor('GRAY'))
EgtSetColor( nNewEntId, EgtStdColor('MAROON'))
end
-- estraggo i contorni di tutte le superfici di offset