3dPrinting :
- correzioni nelle intersezioni costolature.
This commit is contained in:
+37
-8
@@ -116,8 +116,9 @@ local function TrimRibsOffset( nCrv, nOffs1, nOffs2, nOffsGrp, bIn)
|
||||
dPar1, dPar2 = dPar2, dPar1
|
||||
end
|
||||
local nCopy = EgtCopyGlob( nCrv, nOffsGrp)
|
||||
EgtTrimCurveEndAtParam( EgtIf( bIn, nCrv, nCopy), dPar1)
|
||||
EgtTrimCurveStartAtParam( EgtIf( bIn, nCopy, nCrv), dPar2)
|
||||
EgtTrimCurveEndAtParam( nCrv, dPar1)
|
||||
EgtTrimCurveStartAtParam( nCopy, dPar2)
|
||||
EgtSetInfo( nCopy, KEY_SPLIT_RIB, nCrv)
|
||||
|
||||
elseif dPar1 or dPar2 then
|
||||
if bIn then
|
||||
@@ -291,13 +292,20 @@ end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
-- Funzione che riordina le costolature nel caso generico
|
||||
local function ReorderRibs( nGrp, bInvertOrder)
|
||||
local function ReorderRibs( nGrp, bInvertOrder, nShells)
|
||||
|
||||
EgtSpInit()
|
||||
local vIds = EgtGetNameInGroup( nGrp, RIBS_CRV .. '*')
|
||||
local vSplitRibs = {}
|
||||
for i = 1, #vIds do
|
||||
local pt = EgtMP( vIds[i], GDB_RT.GLOB)
|
||||
EgtSpAddPoint( pt:getX(), pt:getY(), pt:getZ(), 0, 0, pt:getX(), pt:getY(), pt:getZ(), 0, 0)
|
||||
local nInfo = EgtGetInfo( vIds[i], KEY_SPLIT_RIB, 'i')
|
||||
-- se è ottenuto dalla divisione di una costolatura non va considerato per il TSP ( viene aggiunto in seguito)
|
||||
if nInfo and nShells == 1 then
|
||||
table.insert( vSplitRibs, vIds[i])
|
||||
else
|
||||
local pt = EgtMP( vIds[i], GDB_RT.GLOB)
|
||||
EgtSpAddPoint( pt:getX(), pt:getY(), pt:getZ(), 0, 0, pt:getX(), pt:getY(), pt:getZ(), 0, 0)
|
||||
end
|
||||
end
|
||||
local vOrd, dLen = EgtSpCalculate( SHP_TY.OPEN)
|
||||
EgtSpTerminate()
|
||||
@@ -306,6 +314,14 @@ local function ReorderRibs( nGrp, bInvertOrder)
|
||||
for i = 2, #vOrd do
|
||||
EgtRelocateGlob( vIds[vOrd[i]], vIds[vOrd[i-1]], EgtIf( bInvertOrder, GDB_IN.BEFORE, GDB_IN.AFTER))
|
||||
end
|
||||
|
||||
-- aggiusto tutte le costolature divise
|
||||
for i = 1, #vSplitRibs do
|
||||
local nPrevId = EgtGetInfo( vSplitRibs[i], KEY_SPLIT_RIB, 'i')
|
||||
-- aggiungo come successiva alla costolatura da cui si è generata
|
||||
EgtRelocateGlob( vSplitRibs[i], nPrevId, GDB_IN.AFTER)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------------------------
|
||||
@@ -404,18 +420,31 @@ local function CalcRibsPaths( nSliceGrp, nRibsGrp, LayerParams, nStmId)
|
||||
-- gestione caso speciale di intersezione e 2 passate
|
||||
ReorderRibsInters2Shells( nRibsPathGrp, LayerParams.dStrand)
|
||||
else
|
||||
ReorderRibs( nRibsPathGrp, LayerParams.bRibsInvertOrder)
|
||||
ReorderRibs( nRibsPathGrp, LayerParams.bRibsInvertOrder, LayerParams.nRibsShellsNbr)
|
||||
end
|
||||
|
||||
-- eseguo il trim delle costole con la regione offsettata
|
||||
local vErased = {}
|
||||
local vOrderedRibs = EgtGetNameInGroup( nRibsPathGrp, RIBS_CRV .. '*')
|
||||
for i = 1, #vOrderedRibs do
|
||||
local nCrv, nCnt = EgtTrimCurveWithRegion( vOrderedRibs[i], nSrf, true, false)
|
||||
local nCrv, nCnt = EgtTrimCurveWithRegion( vOrderedRibs[i], nSrf, true, false)
|
||||
if nCnt == 0 then
|
||||
-- lo aggiungo nella tabella delle costolature eliminate
|
||||
vErased[vOrderedRibs[i]] = 1
|
||||
end
|
||||
-- elimino tratti troppo corti
|
||||
for nId = nCrv, nCrv + nCnt - 1 do
|
||||
local dLen = EgtCurveLength( nId)
|
||||
local dLen = EgtCurveLength( nId)
|
||||
if dLen < 10 * MIN_LEN then
|
||||
EgtErase( nId)
|
||||
-- lo aggiungo nella tabella delle costolature eliminate
|
||||
vErased[vOrderedRibs[i]] = 1
|
||||
else
|
||||
local nInfo = EgtGetInfo( nId, KEY_SPLIT_RIB, 'i')
|
||||
-- se la costolatura da cui deriva è stata eliminata, tolgo l'info che le associava
|
||||
if nInfo and vErased[nInfo] then
|
||||
EgtRemoveInfo( nId, KEY_SPLIT_RIB)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user