3dPrinting :
- gestione regioni con numero diverso di passate.
This commit is contained in:
+166
-100
@@ -39,7 +39,7 @@ local function GetLayerParamsForToolPathCalc()
|
||||
LayerParams.dTDiam = EgtGetInfo( s_nPartId, KEY_TOOL_DIAM, 'd')
|
||||
-- Parametri costolature
|
||||
LayerParams.bRibsLink = EgtGetInfo( s_nPartId, KEY_RIBS_LINK, 'b')
|
||||
|
||||
|
||||
return LayerParams
|
||||
end
|
||||
|
||||
@@ -57,6 +57,68 @@ local function ComputeZCorrection( LayerParams)
|
||||
return max( dCorr1, dCorr2)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------
|
||||
local function AddLink( vCrv, nTpathGrpId, nLinkType, dLinkParam, dSPOffs, dStrand, vtSlicing)
|
||||
|
||||
if not vCrv or #vCrv == 0 then return end
|
||||
|
||||
local k = 0
|
||||
for i = 2, #vCrv do
|
||||
|
||||
-- link ha senso solo se la curva corrente è chiusa (eviti extra shell aperte)
|
||||
if EgtCurveIsClosed( vCrv[i]) then
|
||||
|
||||
-- aggiorno k per calcolo dell'offset
|
||||
local sPrevName = EgtGetName( vCrv[i-1])
|
||||
local sCurrName = EgtGetName( vCrv[i])
|
||||
if sPrevName ~= sCurrName then k = k + 1 end
|
||||
|
||||
-- se nessun raccordo modifico solo lo start point della curva
|
||||
if nLinkType == LINK_TYPE.NONE then
|
||||
local dLen = k * dSPOffs
|
||||
if dSPOffs < 0 then
|
||||
dLen = EgtCurveLength( vCrv[i]) + dLen
|
||||
end
|
||||
local dPar = EgtCurveParamAtLength( vCrv[i], dLen)
|
||||
if dPar then EgtChangeClosedCurveStart( vCrv[i], dPar) end
|
||||
|
||||
else
|
||||
-- altrimenti verifico se ha senso creare raccordo
|
||||
local dDist = dist( EgtEP( vCrv[i-1]), EgtSP( vCrv[i]))
|
||||
if dDist < dStrand + 10 then
|
||||
local nLinkId
|
||||
if k > 1 then
|
||||
-- modifico lo start point
|
||||
local dLen = EgtCurveLength( vCrv[i-1]) - abs( dSPOffs)
|
||||
EgtTrimCurveEndAtLen( vCrv[i-1], dLen)
|
||||
EgtChangeClosedCurveStartPoint( vCrv[i], EgtEP( vCrv[i-1]))
|
||||
end
|
||||
-- aggiungo il raccordo
|
||||
EgtTrimCurveEndAtLen( vCrv[i-1], EgtCurveLength( vCrv[i-1]) - dLinkParam / 2)
|
||||
EgtTrimCurveStartAtLen( vCrv[i], dLinkParam / 2)
|
||||
if nLinkType == LINK_TYPE.LINEAR then
|
||||
nLinkId = EgtCurveCompoFromPoints( nTpathGrpId, {EgtEP( vCrv[i-1]), EgtSP( vCrv[i])})
|
||||
elseif nLinkType == LINK_TYPE.BIARC then
|
||||
local frLoc = Frame3d( ORIG(), vtSlicing)
|
||||
local nGrpTmp = EgtGroup( nTpathGrpId, frLoc)
|
||||
local _, _, dAngIni = SphericalFromVector( EgtEV( vCrv[i-1], nGrpTmp))
|
||||
local _, _, dAngFin = SphericalFromVector( EgtSV( vCrv[i], nGrpTmp))
|
||||
nLinkId = EgtBiArc( nGrpTmp, EgtEP( vCrv[i-1], nGrpTmp), EgtSP( vCrv[i], nGrpTmp), dAngIni, dAngFin, 0.5)
|
||||
EgtRelocateGlob( nLinkId, nTpathGrpId, GDB_IN.LAST_SON)
|
||||
EgtErase( nGrpTmp)
|
||||
end
|
||||
|
||||
if nLinkId then
|
||||
EgtRelocate( nLinkId, vCrv[i], GDB_IN.BEFORE)
|
||||
EgtModifyCurveExtrusion( nLinkId, vtSlicing, GDB_RT.GLOB)
|
||||
EgtSetInfo( nLinkId, KEY_TYPE, TYPE.LINK)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
local function AddLeadIn( nCrvId, LayerParams, nGrpId)
|
||||
|
||||
@@ -113,7 +175,7 @@ local function AddLeadOut( nCrvId, LayerParams, nGrpId)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
local function AddRetraction( nCrvId, dCoastingLen, dWipeLen)
|
||||
local function AddRetraction( nCrvId, dCoastingLen, dWipeLen, vtSlicing)
|
||||
|
||||
-- curva ausiliaria per generare correttamente wipe
|
||||
local nCopyId = EgtCopyGlob( nCrvId, nCrvId, GDB_IN.AFTER)
|
||||
@@ -125,26 +187,43 @@ local function AddRetraction( nCrvId, dCoastingLen, dWipeLen)
|
||||
if dCoastingLen > GEO.EPS_SMALL then
|
||||
nCoastingId = EgtCopyGlob( nCrvId, nCrvId, GDB_IN.AFTER)
|
||||
local dPar = EgtCurveParamAtLength( nCoastingId, EgtCurveLength( nCoastingId) - dCoastingLen)
|
||||
if not dPar then
|
||||
EgtErase( nCopyId)
|
||||
if not dPar then
|
||||
EgtErase( nCoastingId)
|
||||
return
|
||||
end
|
||||
EgtTrimCurveStartAtParam( nCoastingId, dPar)
|
||||
-- aggiorno la curva originale
|
||||
if dPar > GEO.EPS_SMALL then
|
||||
EgtTrimCurveEndAtParam( nCrvId, dPar)
|
||||
nCoastingId = nil
|
||||
else
|
||||
EgtErase( nCrvId)
|
||||
EgtTrimCurveStartAtParam( nCoastingId, dPar)
|
||||
-- aggiorno la curva originale
|
||||
if dPar > GEO.EPS_SMALL then
|
||||
EgtTrimCurveEndAtParam( nCrvId, dPar)
|
||||
else
|
||||
EgtErase( nCrvId)
|
||||
end
|
||||
EgtSetName( nCoastingId, COASTING_CRV)
|
||||
EgtSetInfo( nCoastingId, KEY_TYPE, TYPE.COASTING)
|
||||
EgtSetColor( nCoastingId, EgtStdColor('ORANGE'))
|
||||
end
|
||||
EgtSetName( nCoastingId, COASTING_CRV)
|
||||
EgtSetInfo( nCoastingId, KEY_TYPE, TYPE.COASTING)
|
||||
EgtSetColor( nCoastingId, EgtStdColor('ORANGE'))
|
||||
end
|
||||
|
||||
if dWipeLen > GEO.EPS_SMALL then
|
||||
local nWipeId = EgtCopyGlob( nCopyId, nCoastingId or nCrvId, GDB_IN.AFTER)
|
||||
EgtTrimCurveEndAtLen( nWipeId, dWipeLen)
|
||||
-- se shell
|
||||
local nWipeId
|
||||
local nType = EgtGetInfo( nCrvId, KEY_TYPE, 'i')
|
||||
local bClosedExtraShell = EgtGetInfo( nCrvId, KEY_CLOSED_EXTRA_SHELL, 'b') or false
|
||||
if nType == TYPE.OUTER_SHELL or nType == TYPE.INNER_SHELL or bClosedExtraShell then
|
||||
-- se shell o extra shell chiusa
|
||||
nWipeId = EgtCopyGlob( nCopyId, nCoastingId or nCrvId, GDB_IN.AFTER)
|
||||
EgtTrimCurveEndAtLen( nWipeId, dWipeLen)
|
||||
else
|
||||
-- se extra shell aperta
|
||||
local bInverted = EgtGetInfo( nCrvId, KEY_INVERTED_CURVE, 'b') or false
|
||||
local vtDir = EgtEV( nCoastingId or nCrvId)
|
||||
vtDir:rotate( vtSlicing, EgtIf( bInverted, 90, -90))
|
||||
local ptS = EgtEP( nCoastingId or nCrvId)
|
||||
local ptE = ptS + vtDir * dWipeLen
|
||||
nWipeId = EgtCurveCompoFromPoints( EgtGetParent( nCrvId), {ptS, ptE})
|
||||
EgtRelocateGlob( nWipeId, nCoastingId or nCrvId, GDB_IN.AFTER)
|
||||
end
|
||||
|
||||
EgtSetName( nWipeId, WIPE_CRV)
|
||||
EgtSetInfo( nWipeId, KEY_TYPE, TYPE.WIPE)
|
||||
EgtSetColor( nWipeId, EgtStdColor('TEAL'))
|
||||
@@ -155,45 +234,62 @@ local function AddRetraction( nCrvId, dCoastingLen, dWipeLen)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
local function AddRetractionOnLastCrv( nTpathGrpId, LayerParams)
|
||||
|
||||
local nCrvId = EgtGetLastNameInGroup( nTpathGrpId, SHELL_CRV .. "*")
|
||||
local function AddRetractionOnLastCrv( nCrvId, nTpathGrpId, LayerParams)
|
||||
|
||||
if LayerParams.nLeadOutType == LEAD_TYPE.NONE then
|
||||
AddRetraction( nCrvId, LayerParams.dCoastingLen, LayerParams.dWipeLen)
|
||||
AddRetraction( nCrvId, LayerParams.dCoastingLen, LayerParams.dWipeLen, LayerParams.vtSlicing)
|
||||
else
|
||||
local nLeadOutId = EgtGetLastInGroup( nTpathGrpId)
|
||||
local dLen = EgtCurveLength( nLeadOutId)
|
||||
if dLen > LayerParams.dCoastingLen - 500 * GEO.EPS_SMALL then
|
||||
-- coinvolge solo la curva di lead out
|
||||
local dNewCoastingLen = EgtIf( abs( LayerParams.dCoastingLen - dLen) < 500 * GEO.EPS_SMALL, dLen, LayerParams.dCoastingLen) -- verifico se interamente coinvolta
|
||||
AddRetraction( nLeadOutId, dNewCoastingLen, 0.0)
|
||||
AddRetraction( nLeadOutId, dNewCoastingLen, 0.0, LayerParams.vtSlicing)
|
||||
else
|
||||
-- coinvolge parte dell'ultima shell crv
|
||||
local dNewCoastingLen = LayerParams.dCoastingLen - dLen
|
||||
local nCoastingId = AddRetraction( nCrvId, dNewCoastingLen, 0.0)
|
||||
local nCoastingId = AddRetraction( nCrvId, dNewCoastingLen, 0.0, LayerParams.vtSlicing)
|
||||
EgtAddCurveCompoCurve( nCoastingId, nLeadOutId)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
local function VerifyRibsLink( nLinkId, nCurr, nNext)
|
||||
local function VerifyRibsLink( nLinkId, nCurr, nNext, dStrand)
|
||||
|
||||
-- verifico se il link interseca una delle altre costolature
|
||||
local nGrp = EgtGetParent( nCurr)
|
||||
|
||||
-- regione occupata dal link
|
||||
local nTotLink = EgtCopyGlob( nLinkId, nGrp)
|
||||
local nCopy = EgtCopyGlob( nLinkId, nGrp)
|
||||
EgtInvertCurve( nCopy)
|
||||
EgtAddCurveCompoCurve( nTotLink, nCopy)
|
||||
local nOffs = EgtOffsetCurveAdv( nTotLink, dStrand * 0.5)
|
||||
if not nOffs or nOffs == GDB_ID.NULL then
|
||||
nOffs = nTotLink
|
||||
end
|
||||
|
||||
-- verifico se il link interseca una delle altre costolature
|
||||
local vRibsIds = EgtGetNameInGroup( nGrp, RIBS_CRV .. '*')
|
||||
for i = 1, #vRibsIds do
|
||||
if vRibsIds[i] ~= nCurr and vRibsIds[i] ~= nNext then
|
||||
local ptInt = EgtIP( nLinkId, vRibsIds[i], ORIG())
|
||||
if ptInt then return false end
|
||||
local ptInt = EgtIP( nOffs, vRibsIds[i], ORIG())
|
||||
local ptInt2 = EgtIP( nLinkId, vRibsIds[i], ORIG())
|
||||
if ptInt or ptInt2 then
|
||||
EgtErase( nOffs)
|
||||
EgtErase( nTotLink)
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
EgtErase( nOffs)
|
||||
EgtErase( nTotLink)
|
||||
return true
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
local function CalcRibsLink( nCurr, nNext, nLoopGrp, bForceLink)
|
||||
local function CalcRibsLink( nCurr, nNext, nLoopGrp, dStrand, bForceLink)
|
||||
|
||||
local ptS = EgtEP( nCurr)
|
||||
local ptE = EgtSP( nNext)
|
||||
@@ -236,7 +332,7 @@ local function CalcRibsLink( nCurr, nNext, nLoopGrp, bForceLink)
|
||||
EgtSetInfo( nLinkId, KEY_TYPE, TYPE.RIB)
|
||||
if bInvert then EgtInvertCurve( nLinkId) end
|
||||
-- verifico se è valido
|
||||
local bValid = VerifyRibsLink( nLinkId, nCurr, nNext)
|
||||
local bValid = VerifyRibsLink( nLinkId, nCurr, nNext, dStrand)
|
||||
if not bValid then
|
||||
EgtErase( nLinkId)
|
||||
EgtErase( nCopyId)
|
||||
@@ -450,12 +546,12 @@ local function CalcRibsToolPath( nCrvGrp, 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('GRAY'))
|
||||
end
|
||||
|
||||
-- estraggo i contorni di tutte le superfici di offset
|
||||
local nLoopGrp = EgtGroup( nRibsGrp)
|
||||
local nSrfId = EgtGetFirstNameInGroup( nRibsGrp, LAYER_SRF)
|
||||
local nSrfId = EgtGetFirstNameInGroup( nRibsGrp, TOT_SHELL_TRIM_SURF)
|
||||
while nSrfId do
|
||||
local nChunksNbr = EgtSurfFrChunkCount( nSrfId)
|
||||
for i = 0, nChunksNbr do
|
||||
@@ -468,7 +564,7 @@ local function CalcRibsToolPath( nCrvGrp, nTpathGrpId, LayerParams, dCorrZ)
|
||||
end
|
||||
end
|
||||
end
|
||||
nSrfId = EgtGetNextName( nSrfId, LAYER_SRF)
|
||||
nSrfId = EgtGetNextName( nSrfId, TOT_SHELL_TRIM_SURF)
|
||||
end
|
||||
|
||||
-- recupero i gruppi delle costolature
|
||||
@@ -488,7 +584,7 @@ local function CalcRibsToolPath( nCrvGrp, nTpathGrpId, LayerParams, dCorrZ)
|
||||
-- orientamento del primo gruppo di curve
|
||||
local bInvert = EgtGetInfo( tabRibs[1][1], KEY_RIBS_INVERT_DIR, 'b')
|
||||
if not bSpecialCase then
|
||||
for i = 1, #tabRibs do
|
||||
for i = 1, #tabRibs do
|
||||
local nInfo = EgtGetInfo( tabRibs[i][1], KEY_SPLIT_RIB, 'i')
|
||||
local nShellsNbr = EgtGetInfo( tabRibs[i][1], KEY_RIBS_SHELLS_NBR, 'i')
|
||||
-- aggiorno bInvert per il gruppo di costolature analizzato
|
||||
@@ -534,15 +630,15 @@ local function CalcRibsToolPath( nCrvGrp, nTpathGrpId, LayerParams, dCorrZ)
|
||||
-- collego le passate di una stessa costolatura
|
||||
for i = 1, #tabRibs do
|
||||
for j = 1, #tabRibs[i] - 1 do
|
||||
CalcRibsLink( tabRibs[i][j], tabRibs[i][j + 1], nLoopGrp, true)
|
||||
CalcRibsLink( tabRibs[i][j], tabRibs[i][j + 1], nLoopGrp, LayerParams.dStrand, true)
|
||||
if not bSpecialCase then
|
||||
-- creo link fittizio per eliminare tratto corrispondente sulla curva di offset
|
||||
local nFakeLink = CalcRibsLink( tabRibs[i][j + 1], tabRibs[i][j], nLoopGrp, false)
|
||||
local nFakeLink = CalcRibsLink( tabRibs[i][j + 1], tabRibs[i][j], nLoopGrp, LayerParams.dStrand, false)
|
||||
EgtErase( nFakeLink)
|
||||
end
|
||||
end
|
||||
if bSpecialCase then
|
||||
local nFakeLink = CalcRibsLink( tabRibs[i][#tabRibs[i]], tabRibs[i][1], nLoopGrp, false)
|
||||
local nFakeLink = CalcRibsLink( tabRibs[i][#tabRibs[i]], tabRibs[i][1], nLoopGrp, LayerParams.dStrand, false)
|
||||
EgtErase( nFakeLink)
|
||||
end
|
||||
end
|
||||
@@ -550,7 +646,7 @@ local function CalcRibsToolPath( nCrvGrp, nTpathGrpId, LayerParams, dCorrZ)
|
||||
if LayerParams.bRibsLink then
|
||||
for i = 1, #tabRibs - 1 do
|
||||
local nCnt = #tabRibs[i]
|
||||
CalcRibsLink( tabRibs[i][nCnt], tabRibs[i + 1][1], nLoopGrp, false)
|
||||
CalcRibsLink( tabRibs[i][nCnt], tabRibs[i + 1][1], nLoopGrp, LayerParams.dStrand, false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -634,11 +730,12 @@ function CalcToolPath.Exec( nPartId)
|
||||
local nEntId = EgtGetFirstInGroup( nPathGrpId)
|
||||
while nEntId do
|
||||
local nNewEntId = EgtCopyGlob( nEntId, nTpathGrpId, EgtIf( LayerParams.nOrder == PRINT_ORDER.INF_INT_EXT, GDB_IN.FIRST_SON, GDB_IN.LAST_SON))
|
||||
-- correggo posizione in Z ( per essere sicuri di appoggiare sul piano)
|
||||
-- correggo posizione in Z ( per essere sicuri di appoggiare sul piano)
|
||||
EgtMove( nNewEntId, dCorrZ * Z_AX(), GDB_RT.GLOB)
|
||||
-- mi sposto dell'altezza layer
|
||||
EgtMove( nNewEntId, LayerParams.dLayHeight * LayerParams.vtSlicing, GDB_RT.GLOB)
|
||||
if LayerParams.bInvert then
|
||||
-- eventuale inversione
|
||||
if EgtCurveIsClosed( nNewEntId) and LayerParams.bInvert then
|
||||
EgtInvertCurve( nNewEntId)
|
||||
end
|
||||
EgtModifyCurveExtrusion( nNewEntId, LayerParams.vtSlicing, GDB_RT.GLOB)
|
||||
@@ -646,63 +743,32 @@ function CalcToolPath.Exec( nPartId)
|
||||
nEntId = EgtGetNext( nEntId)
|
||||
end
|
||||
|
||||
-- aggiungo gli opportuni raccordi
|
||||
local nPrevId = EgtGetFirstInGroup( nTpathGrpId)
|
||||
local nCurrId = EgtGetNext( nPrevId or GDB_ID.NULL)
|
||||
k = 0
|
||||
local nPrevShellNbr
|
||||
if nPrevId then nPrevShellNbr = tonumber( EgtGetName( nPrevId):sub(6)) end
|
||||
while nCurrId do
|
||||
|
||||
local nCurrShellNbr = tonumber( EgtGetName( nCurrId):sub(6))
|
||||
if nCurrShellNbr ~= nPrevShellNbr then k = k + 1 end
|
||||
|
||||
-- se nessun raccordo modifico solo lo start point della curva
|
||||
if LayerParams.nLinkType == LINK_TYPE.NONE then
|
||||
local dLen = k * LayerParams.dSPOffs
|
||||
if LayerParams.dSPOffs < 0 then
|
||||
dLen = EgtCurveLength( nCurrId) + dLen
|
||||
end
|
||||
local dPar = EgtCurveParamAtLength( nCurrId, dLen)
|
||||
if dPar then EgtChangeClosedCurveStart( nCurrId, dPar) end
|
||||
|
||||
else
|
||||
-- altrimenti verifico se ha senso creare raccordo
|
||||
if abs( dist( EgtEP( nPrevId), EgtSP( nCurrId))) < LayerParams.dStrand + 10 then
|
||||
local nLinkId
|
||||
if k > 1 then
|
||||
-- modifico lo start point
|
||||
local dLen = EgtCurveLength( nPrevId) - abs( LayerParams.dSPOffs)
|
||||
EgtTrimCurveEndAtLen( nPrevId, dLen)
|
||||
EgtChangeClosedCurveStartPoint( nCurrId, EgtEP( nPrevId))
|
||||
end
|
||||
-- aggiungo il raccordo
|
||||
EgtTrimCurveEndAtLen( nPrevId, EgtCurveLength( nPrevId) - LayerParams.dLinkParam / 2)
|
||||
EgtTrimCurveStartAtLen( nCurrId, LayerParams.dLinkParam / 2)
|
||||
if LayerParams.nLinkType == LINK_TYPE.LINEAR then
|
||||
nLinkId = EgtCurveCompoFromPoints( nTpathGrpId, {EgtEP( nPrevId), EgtSP( nCurrId)})
|
||||
elseif LayerParams.nLinkType == LINK_TYPE.BIARC then
|
||||
local frLoc = Frame3d( ORIG(), LayerParams.vtSlicing)
|
||||
local nGrpTmp = EgtGroup( nTpathGrpId, frLoc)
|
||||
local _, _, dAngIni = SphericalFromVector( EgtEV( nPrevId, nGrpTmp))
|
||||
local _, _, dAngFin = SphericalFromVector( EgtSV( nCurrId, nGrpTmp))
|
||||
nLinkId = EgtBiArc( nGrpTmp, EgtEP( nPrevId, nGrpTmp), EgtSP( nCurrId, nGrpTmp), dAngIni, dAngFin, 0.5)
|
||||
EgtRelocateGlob( nLinkId, nTpathGrpId, GDB_IN.LAST_SON)
|
||||
EgtErase( nGrpTmp)
|
||||
end
|
||||
|
||||
if nLinkId then
|
||||
EgtRelocate( nLinkId, nCurrId, GDB_IN.BEFORE)
|
||||
EgtModifyCurveExtrusion( nLinkId, LayerParams.vtSlicing, GDB_RT.GLOB)
|
||||
EgtSetInfo( nLinkId, KEY_TYPE, TYPE.LINK)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
nPrevShellNbr = nCurrShellNbr
|
||||
nPrevId = nCurrId
|
||||
nCurrId = EgtGetNext( nCurrId)
|
||||
-- aggiungo gli opportuni raccordi sulle shell complete
|
||||
local vIds = EgtGetNameInGroup( nTpathGrpId, SHELL_CRV .. '*')
|
||||
local vIdsExtra = EgtGetNameInGroup( nTpathGrpId, EXTRA_SHELL_CRV .. '*') or {}
|
||||
for i = 1, #vIdsExtra do
|
||||
table.insert( vIds, vIdsExtra[i])
|
||||
end
|
||||
AddLink( vIds, nTpathGrpId, LayerParams.nLinkType, LayerParams.dLinkParam, LayerParams.dSPOffs, LayerParams.dStrand, LayerParams.vtSlicing)
|
||||
|
||||
-- aggiungo gli opportuni raccondi sulle shell con numero diverso di passate
|
||||
local nPrev = EgtGetFirstNameInGroup( nTpathGrpId, EXTRA_SHELL_CRV .. '*')
|
||||
local sPrevName = EgtGetName( nPrev or GDB_ID.NULL)
|
||||
local nCurr = EgtGetNextName( nPrev or GDB_ID.NULL, EXTRA_SHELL_CRV .. '*')
|
||||
while nCurr do
|
||||
local sCurrName = EgtGetName( nCurr)
|
||||
if sCurrName == sPrevName then
|
||||
local ptS = EgtEP( nPrev)
|
||||
local ptE = EgtSP( nCurr)
|
||||
local nLinkId = EgtCurveCompoFromPoints( nTpathGrpId, {ptS, ptE})
|
||||
EgtRelocateGlob( nLinkId, nCurr, GDB_IN.BEFORE)
|
||||
EgtSetInfo( nLinkId, KEY_TYPE, TYPE.LINK)
|
||||
end
|
||||
sPrevName = sCurrName
|
||||
nPrev = nCurr
|
||||
nCurr = EgtGetNextName( nCurr, EXTRA_SHELL_CRV .. '*')
|
||||
end
|
||||
|
||||
|
||||
-- aggiungo leadin/leadout
|
||||
local nFirstCurve = EgtGetFirstInGroup( nTpathGrpId)
|
||||
@@ -719,23 +785,23 @@ function CalcToolPath.Exec( nPartId)
|
||||
-- aggiungo coasting/wipe
|
||||
local nId = EgtGetFirstNameInGroup( nTpathGrpId, SHELL_CRV .. "*")
|
||||
local nFirstId = nId
|
||||
local nLastId = EgtGetLastNameInGroup( nTpathGrpId, SHELL_CRV .. "*")
|
||||
while nId do
|
||||
local nLastId = EgtGetLastNameInGroup( nTpathGrpId, EXTRA_SHELL_CRV .. "*") or EgtGetLastNameInGroup( nTpathGrpId, SHELL_CRV .. "*")
|
||||
while nId do
|
||||
if nId == nLastId then
|
||||
AddRetractionOnLastCrv( nTpathGrpId, LayerParams)
|
||||
AddRetractionOnLastCrv( nId, nTpathGrpId, LayerParams)
|
||||
else
|
||||
local nNextId = EgtGetNext( nId)
|
||||
if EgtGetInfo( nNextId, KEY_TYPE, 'i') ~= TYPE.LINK then
|
||||
-- aggiungo retrazione
|
||||
if nId == nFirstId then
|
||||
local dWipeLen = EgtIf( LayerParams.nLeadInType == LEAD_TYPE.NONE, LayerParams.dWipeLen, 0)
|
||||
AddRetraction( nId, LayerParams.dCoastingLen, dWipeLen)
|
||||
AddRetraction( nId, LayerParams.dCoastingLen, dWipeLen, LayerParams.vtSlicing)
|
||||
else
|
||||
AddRetraction( nId, LayerParams.dCoastingLen, LayerParams.dWipeLen)
|
||||
AddRetraction( nId, LayerParams.dCoastingLen, LayerParams.dWipeLen, LayerParams.vtSlicing)
|
||||
end
|
||||
end
|
||||
end
|
||||
nId = EgtGetNextName( nId, SHELL_CRV .. "*")
|
||||
nId = EgtGetNextName( nId, SHELL_CRV .. "*") or EgtGetNextName( nId, EXTRA_SHELL_CRV .. "*")
|
||||
end
|
||||
|
||||
-- sistemo le costolature
|
||||
|
||||
Reference in New Issue
Block a user