3dPrinting :
- possibilità di assegnare parametri diversi a costolature diverse.
This commit is contained in:
+186
-107
@@ -24,8 +24,6 @@ local function GetLayerParamsForPathCalc()
|
||||
LayerParams.nFloorNbr = EgtGetInfo( s_nPartId, KEY_FLOOR_NBR, 'i')
|
||||
LayerParams.vtSlicing = EgtGetInfo( s_nPartId, KEY_SLICING_DIR, 'v')
|
||||
-- parametri costolature
|
||||
LayerParams.dRibsOverlap = EgtGetInfo( s_nPartId, KEY_RIBS_OVERLAP, 'd')
|
||||
LayerParams.nRibsShellsNbr = EgtGetInfo( s_nPartId, KEY_RIBS_SHELLS_NBR, 'i')
|
||||
LayerParams.bRibsInvertOrder = EgtGetInfo( s_nPartId, KEY_RIBS_INVERT_ORDER, 'b')
|
||||
return LayerParams
|
||||
end
|
||||
@@ -67,6 +65,21 @@ local function GetLayerStartPoint( nLayId, vtSlicing)
|
||||
return vPtStart
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------
|
||||
local function ComputeSurfOffset( nSrf, nGrpId, dOffs)
|
||||
|
||||
local nCopySrf = EgtCopy( nSrf, nGrpId)
|
||||
local bOk = EgtSurfFrOffset( nCopySrf, dOffs)
|
||||
local bExists = EgtSurfFrChunkCount( nCopySrf) > 0
|
||||
if not bOk or not bExists then
|
||||
EgtErase( nCopySrf)
|
||||
nCopySrf = EgtCopyGlob( nSrf, nGrpId)
|
||||
bOk = EgtSurfFrOffset( nCopySrf, dOffs + 0.05)
|
||||
bExists = EgtSurfFrChunkCount( nCopySrf) > 0
|
||||
end
|
||||
return bOk, bExists, nCopySrf
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function GetPathsFromSurf( nSrfId, sName, nType, nGrpId, vPtStart)
|
||||
|
||||
@@ -141,7 +154,7 @@ local function TrimRibsOffset( nCrv, nOffs1, nOffs2, nOffsGrp, bIn)
|
||||
local ptInt2 = EgtIP( nCrv, nOffs2, ORIG())
|
||||
local dPar1, dPar2
|
||||
if ptInt1 then dPar1 = EgtCurveParamAtPoint( nCrv, ptInt1) end
|
||||
if ptInt2 then dPar2 = EgtCurveParamAtPoint( nCrv, ptInt2) end
|
||||
if ptInt2 then dPar2 = EgtCurveParamAtPoint( nCrv, ptInt2) end
|
||||
|
||||
if dPar1 and dPar2 then
|
||||
-- la curva viene spezzata in tre parti
|
||||
@@ -167,9 +180,13 @@ end
|
||||
local function AdjustRibsOffsetForIntersection( nCrv1, nCrv2, LayerParams, nOffsGrp, bIn)
|
||||
|
||||
-- calcolo gli offset della curva principale ( nCrv1) da usare per trim
|
||||
local dOffs = ( LayerParams.nRibsShellsNbr - 1) * LayerParams.dStrand / 2
|
||||
local nOffsM = EgtOffsetCurveAdv( nCrv1, - dOffs - ( 1 - LayerParams.dRibsOverlap / 100) * LayerParams.dStrand)
|
||||
local nOffsP = EgtOffsetCurveAdv( nCrv1, dOffs + ( 1 - LayerParams.dRibsOverlap / 100) * LayerParams.dStrand)
|
||||
local nShells = EgtGetInfo( nCrv1, KEY_RIBS_SHELLS_NBR, 'i')
|
||||
local nOverlap1 = EgtGetInfo( nCrv1, KEY_RIBS_OVERLAP, 'i')
|
||||
local nOverlap2 = EgtGetInfo( nCrv2, KEY_RIBS_OVERLAP, 'i')
|
||||
local nOverlap = min( nOverlap1, nOverlap2)
|
||||
local dOffs = ( nShells - 1) * LayerParams.dStrand / 2
|
||||
local nOffsM = EgtOffsetCurveAdv( nCrv1, - dOffs - ( 1 - nOverlap / 100) * LayerParams.dStrand)
|
||||
local nOffsP = EgtOffsetCurveAdv( nCrv1, dOffs + ( 1 - nOverlap / 100) * LayerParams.dStrand)
|
||||
local vSplit = {}
|
||||
|
||||
-- recupero gli offset della curva secondaria ( nCrv2)
|
||||
@@ -186,7 +203,7 @@ end
|
||||
--------------------------------------------------------------------
|
||||
-- Funzione che sistema le intersezioni fra costolature nel caso di 2 passate
|
||||
local function AdjustRibsOffsetForIntersection2Shells( nCrv1, nCrv2, LayerParams, nOffsGrp, bIn)
|
||||
|
||||
|
||||
-- recupero gli offset delle due curve
|
||||
local vOffs1 = EgtGetNameInGroup( nOffsGrp, EgtGetName( nCrv1))
|
||||
local vOffs2 = EgtGetNameInGroup( nOffsGrp, EgtGetName( nCrv2))
|
||||
@@ -215,7 +232,7 @@ local function AdjustRibsOffsetForIntersection2Shells( nCrv1, nCrv2, LayerParams
|
||||
local _, dParE = EgtCurveDomain( nCrv1)
|
||||
bInCrv1 = abs( dParInt - dParE) < 100 * GEO.EPS_SMALL
|
||||
end
|
||||
TrimRibsOffset( vOffs1[i], vOffs2[vIds[1]], vOffs2[vIds[2]], nOffsGrp, bInCrv1)
|
||||
TrimRibsOffset( vOffs1[i], vOffs2[vIds[1]], vOffs2[vIds[2]], nOffsGrp, bInCrv1)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -230,17 +247,16 @@ local function AdjustRibsOffsetForIntersection2Shells( nCrv1, nCrv2, LayerParams
|
||||
if #vIds > 0 then
|
||||
if #vIds == 1 then table.insert( vIds, EgtIf( vIds[1] == 1, 2, 1)) end
|
||||
TrimRibsOffset( vOffs2[i], vCopy1[vIds[1]], vCopy1[vIds[2]], nOffsGrp, bIn)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #vCopy1 do
|
||||
EgtErase( vCopy1[i])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
local function HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPathGrp)
|
||||
local function HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPathGrp, bAllTwoStrands)
|
||||
|
||||
local nCrvGrp = EgtGetParent( nRibsPathGrp)
|
||||
local nSrf = EgtGetFirstInGroup( nCrvGrp)
|
||||
@@ -261,7 +277,7 @@ local function HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPa
|
||||
end
|
||||
end
|
||||
|
||||
local bInters = false
|
||||
local bInters = false
|
||||
local vSplit = {}
|
||||
for i = 1, #vRibsIds do
|
||||
-- verifico se interseca uno dei setti successivi
|
||||
@@ -282,7 +298,7 @@ local function HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPa
|
||||
nCrv1, nCrv2 = nCrv2, nCrv1
|
||||
end
|
||||
|
||||
if LayerParams.nRibsShellsNbr == 2 then
|
||||
if bAllTwoStrands then
|
||||
-- nel caso di 2 passate gestione speciale
|
||||
AdjustRibsOffsetForIntersection2Shells( nCrv1, nCrv2, LayerParams, nRibsPathGrp, bIn)
|
||||
else
|
||||
@@ -325,27 +341,30 @@ end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
-- Funzione che riordina le costolature nel caso generico
|
||||
local function ReorderRibs( nGrp, bInvertOrder, nShells)
|
||||
local function ReorderRibs( nGrp, bInvertOrder)
|
||||
|
||||
EgtSpInit()
|
||||
local vIds = EgtGetNameInGroup( nGrp, RIBS_CRV .. '*')
|
||||
local vSplitRibs = {}
|
||||
local vSPRibs = {}
|
||||
for i = 1, #vIds do
|
||||
local nInfo = EgtGetInfo( vIds[i], KEY_SPLIT_RIB, 'i')
|
||||
local nShells = EgtGetInfo( vIds[i], KEY_RIBS_SHELLS_NBR, '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)
|
||||
table.insert( vSPRibs, vIds[i])
|
||||
end
|
||||
end
|
||||
local vOrd, dLen = EgtSpCalculate( SHP_TY.OPEN)
|
||||
EgtSpTerminate()
|
||||
|
||||
EgtRelocateGlob( vIds[vOrd[1]], nGrp, EgtIf( bInvertOrder, GDB_IN.LAST, GDB_IN.FIRST))
|
||||
EgtRelocateGlob( vSPRibs[vOrd[1]], nGrp, EgtIf( bInvertOrder, GDB_IN.LAST, GDB_IN.FIRST))
|
||||
for i = 2, #vOrd do
|
||||
EgtRelocateGlob( vIds[vOrd[i]], vIds[vOrd[i-1]], EgtIf( bInvertOrder, GDB_IN.BEFORE, GDB_IN.AFTER))
|
||||
EgtRelocateGlob( vSPRibs[vOrd[i]], vSPRibs[vOrd[i-1]], EgtIf( bInvertOrder, GDB_IN.BEFORE, GDB_IN.AFTER))
|
||||
end
|
||||
|
||||
-- aggiusto tutte le costolature divise
|
||||
@@ -357,13 +376,70 @@ local function ReorderRibs( nGrp, bInvertOrder, nShells)
|
||||
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------------------
|
||||
local function CopyInfo( nSouId, nDestId, sInfo, sType)
|
||||
local info = EgtGetInfo( nSouId, sInfo, sType)
|
||||
EgtSetInfo( nDestId, sInfo, info)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------------------
|
||||
local function ReassignInfo( nCrv, nCnt, vOrig)
|
||||
|
||||
for nId = nCrv, nCrv + nCnt - 1 do
|
||||
local ptS = EgtSP( nId)
|
||||
local ptE = EgtEP( nId)
|
||||
|
||||
-- info overlap
|
||||
local nOverlap = EgtGetInfo( s_nPartId, KEY_RIBS_OVERLAP, 'i')
|
||||
EgtSetInfo( nId, KEY_RIBS_OVERLAP, nOverlap)
|
||||
|
||||
local bStart = false
|
||||
local bEnd = false
|
||||
while not bStart and not bEnd do
|
||||
-- scorro le curve originarie per capire da quali deriva
|
||||
for i = 1, #vOrig do
|
||||
local ptSOrig = EgtSP( vOrig[i])
|
||||
local ptEOrig = EgtEP( vOrig[i])
|
||||
|
||||
-- verifico se corrisponde al suo start
|
||||
if AreSamePointApprox( ptS, ptSOrig) or AreSamePointApprox( ptS, ptEOrig) then
|
||||
CopyInfo( vOrig[i], nId, KEY_RIBS_LEAD_IN_INVERT, 'b')
|
||||
CopyInfo( vOrig[i], nId, KEY_RIBS_LEAD_IN_LEN, 'd')
|
||||
bStart = true
|
||||
end
|
||||
-- verifico se corrisponde al suo end
|
||||
if AreSamePointApprox( ptE, ptSOrig) or AreSamePointApprox( ptE, ptEOrig) then
|
||||
CopyInfo( vOrig[i], nId, KEY_RIBS_LEAD_OUT_INVERT, 'b')
|
||||
CopyInfo( vOrig[i], nId, KEY_RIBS_LEAD_OUT_LEN, 'd')
|
||||
CopyInfo( vOrig[i], nId, KEY_RIBS_LEAD_OUT_COASTING, 'd')
|
||||
CopyInfo( vOrig[i], nId, KEY_RIBS_LEAD_OUT_WIPE, 'd')
|
||||
CopyInfo( vOrig[i], nId, KEY_RIBS_LEAD_OUT_WIPE_DIR, 'd')
|
||||
bEnd = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- dopo aver salvato le info è inutile conservare le curve originali
|
||||
for i = 1, #vOrig do
|
||||
EgtErase( vOrig[i])
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------------------------
|
||||
-- Funzione che riordina le costolature nel caso di intersezioni e 2 passate
|
||||
local function ReorderRibsInters2Shells( nOffsGrp, dStrand)
|
||||
|
||||
local vOffs = EgtGetNameInGroup( nOffsGrp, RIBS_CRV .. '*')
|
||||
-- copio le curve originali ( per recuperarne le info)
|
||||
local vCopy = {}
|
||||
for i = 1, #vOffs do
|
||||
local nNewId = EgtCopy( vOffs[i], nOffsGrp)
|
||||
table.insert( vCopy, nNewId)
|
||||
end
|
||||
|
||||
-- concateno le curve
|
||||
local nCrv, nCnt = EgtCurveCompoByChain( nOffsGrp, vOffs, ORIG())
|
||||
local nCrv, nCnt = EgtCurveCompoByChain( nOffsGrp, vOffs, ORIG())
|
||||
|
||||
local vIds = {}
|
||||
for i = nCrv, nCrv + nCnt - 1 do
|
||||
@@ -417,73 +493,127 @@ local function ReorderRibsInters2Shells( nOffsGrp, dStrand)
|
||||
else
|
||||
nCurrCrv = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Recupero le info dalle curve originali
|
||||
ReassignInfo( nCrv, nCnt, vCopy)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
local function CalcRibsPaths( nSliceGrp, nRibsGrp, LayerParams, nStmId)
|
||||
local function CalcRibsPaths( nSliceGrp, nRibsGrp, LayerParams, nStmId, nIdx)
|
||||
|
||||
-- calcolo gli offset
|
||||
local dOffs = ( LayerParams.nRibsShellsNbr - 1) * LayerParams.dStrand / 2
|
||||
local nOffsGrp = EgtGroup( nRibsGrp)
|
||||
local vRibs = EgtGetNameInGroup( nRibsGrp, RIBS_CRV .. '*')
|
||||
-- verifico se tutte le costolature vengono fatte con 2 passate
|
||||
local bAllTwoStrands = true
|
||||
for i = 1, #vRibs do
|
||||
for k = 0, LayerParams.nRibsShellsNbr - 1 do
|
||||
local nStrand = EgtGetInfo( vRibs[i], KEY_RIBS_SHELLS_NBR, 'i')
|
||||
if nStrand ~= 2 then
|
||||
bAllTwoStrands = false
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- calcolo gli offset
|
||||
local nOffsGrp = EgtGroup( nRibsGrp)
|
||||
for i = 1, #vRibs do
|
||||
local nShellsNbr = EgtGetInfo( vRibs[i], KEY_RIBS_SHELLS_NBR, 'i')
|
||||
local dOffs = ( nShellsNbr - 1) * LayerParams.dStrand / 2
|
||||
for k = 0, nShellsNbr - 1 do
|
||||
local nNewId = EgtOffsetCurveAdv( vRibs[i], - dOffs + k * LayerParams.dStrand)
|
||||
EgtSetName( nNewId, EgtGetName( vRibs[i]))
|
||||
EgtSetInfo( nNewId, KEY_TYPE, TYPE.RIB)
|
||||
EgtRelocateGlob( nNewId, nOffsGrp)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- scorro i gruppi di curve
|
||||
local dOffs = 0.5 * LayerParams.dStrand - LayerParams.dOffs + ( LayerParams.nShellsNbr - 1) * LayerParams.dStrand
|
||||
local nCrvGrp = EgtGetFirstNameInGroup( nSliceGrp, CONTOUR_GRP .. '*')
|
||||
while nCrvGrp do
|
||||
|
||||
-- creo o svuoto il gruppo
|
||||
local nRibsPathGrp = EgtGetFirstNameInGroup( nCrvGrp, RIBS_GRP)
|
||||
local nSrf = EgtGetFirstNameInGroup( nRibsPathGrp, LAYER_SRF)
|
||||
if nSrf then
|
||||
if not nRibsPathGrp then
|
||||
nRibsPathGrp = EgtGroup( nCrvGrp)
|
||||
EgtSetName( nRibsPathGrp, RIBS_GRP)
|
||||
EgtSetStatus( nRibsPathGrp, GDB_ST.OFF)
|
||||
else
|
||||
EgtEmptyGroup( nRibsPathGrp)
|
||||
end
|
||||
|
||||
-- creo le superfici con cui fare i trim
|
||||
local nSrf = EgtGetFirstNameInGroup( nCrvGrp, LAYER_SRF)
|
||||
local bOk, bExists, nSrfBase = ComputeSurfOffset( nSrf, nRibsPathGrp, - dOffs)
|
||||
if not bOk then
|
||||
EgtOutLog( 'Error on Offset for Ribs (layer '..tostring( nIdx)..') - CalcPaths')
|
||||
elseif not bExists then
|
||||
EgtOutLog( 'Warning: Ribs not possibile (layer '..tostring( nIdx)..') - CalcPaths')
|
||||
else
|
||||
local vSurfOffs = {}
|
||||
for i = 1, #vRibs do
|
||||
local nOverlap = EgtGetInfo( vRibs[i], KEY_RIBS_OVERLAP, 'i')
|
||||
if not vSurfOffs[nOverlap] then
|
||||
local dNewOffs = ( 1 - nOverlap / 100) * LayerParams.dStrand
|
||||
local bOk, bExists, nSrfOffs = ComputeSurfOffset( nSrfBase, nRibsPathGrp, - dNewOffs)
|
||||
if bOk and bExists then
|
||||
vSurfOffs[ nOverlap] = nSrfOffs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- gestisco eventuali intersezioni fra costolature
|
||||
local bInters = HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPathGrp)
|
||||
local bInters = HandleRibsIntersections( nRibsGrp, LayerParams, nOffsGrp, nRibsPathGrp, bAllTwoStrands)
|
||||
EgtSetInfo( nRibsPathGrp or GDB_ID.NULL, KEY_RIBS_INTERS, bInters)
|
||||
EgtSetInfo( nRibsPathGrp or GDB_ID.NULL, KEY_RIBS_TWO_STRANDS, bAllTwoStrands)
|
||||
|
||||
-- riordino le costolature
|
||||
if LayerParams.nRibsShellsNbr == 2 and bInters then
|
||||
if bAllTwoStrands and bInters then
|
||||
-- gestione caso speciale di intersezione e 2 passate
|
||||
ReorderRibsInters2Shells( nRibsPathGrp, LayerParams.dStrand)
|
||||
else
|
||||
ReorderRibs( nRibsPathGrp, LayerParams.bRibsInvertOrder, LayerParams.nRibsShellsNbr)
|
||||
ReorderRibs( nRibsPathGrp, LayerParams.bRibsInvertOrder)
|
||||
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)
|
||||
if nCnt == 0 then
|
||||
-- lo aggiungo nella tabella delle costolature eliminate
|
||||
for i = 1, #vOrderedRibs do
|
||||
-- trim con superficie opportuna
|
||||
local nOverlap = EgtGetInfo( vOrderedRibs[i], KEY_RIBS_OVERLAP, 'i')
|
||||
if not vSurfOffs[ nOverlap] then
|
||||
-- la costolatura non è fattibile
|
||||
EgtOutLog( 'Warning: Ribs not possibile (layer '..tostring( nIdx)..') - CalcPaths')
|
||||
EgtErase( vOrderedRibs[i])
|
||||
vErased[vOrderedRibs[i]] = 1
|
||||
end
|
||||
-- elimino tratti troppo corti
|
||||
for nId = nCrv, nCrv + nCnt - 1 do
|
||||
local dLen = EgtCurveLength( nId)
|
||||
if dLen < 10 * MIN_LEN then
|
||||
EgtErase( nId)
|
||||
else
|
||||
local nCrv, nCnt = EgtTrimCurveWithRegion( vOrderedRibs[i], vSurfOffs[nOverlap], true, false)
|
||||
if nCnt == 0 then
|
||||
-- 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)
|
||||
vErased[vOrderedRibs[i]] = 1
|
||||
end
|
||||
-- elimino tratti troppo corti
|
||||
for nId = nCrv, nCrv + nCnt - 1 do
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
if not EgtGetFirstNameInGroup( nRibsPathGrp, RIBS_CRV .. '*') then
|
||||
|
||||
EgtErase( nSrfBase)
|
||||
if not EgtGetFirstNameInGroup( nRibsPathGrp, RIBS_CRV .. '*') then
|
||||
EgtErase( nRibsPathGrp)
|
||||
end
|
||||
nCrvGrp = EgtGetNextName( nCrvGrp, CONTOUR_GRP .. '*')
|
||||
@@ -532,86 +662,35 @@ function CalcPaths.Exec( nPartId, nStmId)
|
||||
-- recupero la superficie ottenuta dallo slicing
|
||||
local nSrf = EgtGetFirstNameInGroup( nCrvGrpId, LAYER_SRF)
|
||||
if nSrf then
|
||||
-- esterno
|
||||
local nSrfId = EgtCopyGlob( nSrf, nCrvGrpId)
|
||||
|
||||
-- parete esterna
|
||||
local dOffs = 0.5 * LayerParams.dStrand - LayerParams.dOffs
|
||||
local bOk = EgtSurfFrOffset( nSrfId, -dOffs)
|
||||
local bExists = EgtSurfFrChunkCount( nSrfId) > 0
|
||||
if not bOk then
|
||||
EgtErase( nSrfId)
|
||||
nSrfId = EgtCopyGlob( nSrf, nCrvGrpId)
|
||||
local dNewOffs = dOffs - 0.05
|
||||
bOk = EgtSurfFrOffset( nSrfId, -dNewOffs)
|
||||
bExists = EgtSurfFrChunkCount( nSrfId) > 0
|
||||
end
|
||||
-- se offset riuscito, estraggo i contorni (pareti esterne)
|
||||
local bOk, bExists, nSrfId = ComputeSurfOffset( nSrf, nCrvGrpId, - dOffs)
|
||||
if not bOk then
|
||||
EgtOutLog( 'Error on ExtOffset (layer '..tostring( nIdx)..') - CalcPaths')
|
||||
elseif not bExists then
|
||||
EgtOutLog( 'Warning : ExtOffset not possible (layer '..tostring( nIdx)..') - CalcPaths')
|
||||
else
|
||||
-- se offset riuscito, estraggo i contorni (pareti esterne)
|
||||
GetPathsFromSurf( nSrfId, SHELL_CRV..'0', TYPE.OUTER_SHELL, nGrpId, vPtStart)
|
||||
end
|
||||
EgtErase( nSrfId)
|
||||
|
||||
-- calcolo pareti interne
|
||||
-- pareti interne
|
||||
for nInd2 = 1, LayerParams.nShellsNbr - 1 do
|
||||
-- offset della superficie originale
|
||||
local nSrfId = EgtCopy( nSrf, nGrpId)
|
||||
local bOk = EgtSurfFrOffset( nSrfId, - dOffs - nInd2 * LayerParams.dStrand)
|
||||
local bExists = EgtSurfFrChunkCount( nSrfId) > 0
|
||||
if not bOk then
|
||||
EgtErase( nSrfId)
|
||||
nSrfId = EgtCopyGlob( nSrf, nCrvGrpId)
|
||||
bOk = EgtSurfFrOffset( nSrfId, -dOffs + 0.05 - nInd2 * LayerParams.dStrand)
|
||||
bExists = EgtSurfFrChunkCount( nSrfId) > 0
|
||||
end
|
||||
-- se offset riuscito, estraggo i contorni ( pareti interne)
|
||||
local bOk, bExists, nSrfId = ComputeSurfOffset( nSrf, nCrvGrpId, - dOffs - nInd2 * LayerParams.dStrand)
|
||||
if not bOk then
|
||||
EgtOutLog( 'Error on IntOffset (layer '..tostring( nIdx)..') - CalcPaths')
|
||||
elseif not bExists then
|
||||
EgtOutLog( 'Warning : IntOffset not possible (layer '..tostring( nIdx)..') - CalcPaths')
|
||||
else
|
||||
-- se offset riuscito, estraggo i contorni ( pareti interne)
|
||||
GetPathsFromSurf( nSrfId, SHELL_CRV..tostring( nInd2), TYPE.INNER_SHELL, nGrpId, vPtStart)
|
||||
end
|
||||
EgtErase( nSrfId)
|
||||
end
|
||||
|
||||
-- costolature
|
||||
if nRibsGrp then
|
||||
|
||||
-- creo o svuoto il gruppo per le costolature
|
||||
local nRibsPathGrp = EgtGetFirstNameInGroup( nCrvGrpId, RIBS_GRP)
|
||||
if not nRibsPathGrp then
|
||||
nRibsPathGrp = EgtGroup( nCrvGrpId)
|
||||
EgtSetName( nRibsPathGrp, RIBS_GRP)
|
||||
EgtSetStatus( nRibsPathGrp, GDB_ST.OFF)
|
||||
else
|
||||
EgtEmptyGroup( nRibsPathGrp)
|
||||
end
|
||||
|
||||
-- calcolo superficie di offset da usare per le costolature
|
||||
local nSrfId = EgtCopy( nSrf, nRibsPathGrp)
|
||||
local dOffs = 0.5 * LayerParams.dStrand - LayerParams.dOffs + ( LayerParams.nShellsNbr - 1) * LayerParams.dStrand + ( 1 - LayerParams.dRibsOverlap / 100) * LayerParams.dStrand
|
||||
local bOk = EgtSurfFrOffset( nSrfId, - dOffs)
|
||||
local bExists = ( bOk and EgtSurfFrChunkCount( nSrfId) > 0)
|
||||
if not bOk then
|
||||
EgtErase( nSrfId)
|
||||
nSrfId = EgtCopyGlob( nSrf, nRibsPathGrp)
|
||||
bOk = EgtSurfFrOffset( nSrfId, - dOffs + 0.05)
|
||||
bExists = ( bOk and EgtSurfFrChunkCount( nSrfId) > 0)
|
||||
end
|
||||
-- se non ho una superficie errore ed elimino il gruppo delle costolature
|
||||
if not bOk then
|
||||
EgtErase( nRibsPathGrp)
|
||||
EgtOutLog( 'Error on Offset (Ribs) (layer '..tostring( nIdx)..') - CalcPaths')
|
||||
elseif not bExists then
|
||||
EgtErase( nRibsPathGrp)
|
||||
EgtOutLog( 'Warning : Ribs not possible (layer '..tostring( nIdx)..') - CalcPaths')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- gestione eventuale floor
|
||||
if nIdx <= LayerParams.nFloorNbr then
|
||||
AddFloor( nSrf, nGrpId, LayerParams, nIdx)
|
||||
@@ -624,7 +703,7 @@ function CalcPaths.Exec( nPartId, nStmId)
|
||||
|
||||
-- sistemo eventuali costolature
|
||||
if nRibsGrp then
|
||||
CalcRibsPaths( vLayIds[nIdx], nRibsGrp, LayerParams, nStmId)
|
||||
CalcRibsPaths( vLayIds[nIdx], nRibsGrp, LayerParams, nStmId, nIdx)
|
||||
end
|
||||
|
||||
if EgtProcessEvents( nIdx / #vLayIds * 100, 0) == 1 then
|
||||
|
||||
Reference in New Issue
Block a user