3dPrinting :
- slicing multiplanare orizzontale - sistemata distanza su spina per slicing multiplanare 45°.
This commit is contained in:
@@ -228,6 +228,7 @@ SLICING_TYPE = {
|
||||
HORIZONTAL = 4,
|
||||
MULTIPLANAR = 5,
|
||||
MULTIPLANAR_DEG45 = 6,
|
||||
MULTIPLANAR_HOR = 7,
|
||||
}
|
||||
|
||||
TYPE = {
|
||||
|
||||
@@ -4344,7 +4344,7 @@ function CalcPaths.Exec( nPartId)
|
||||
|
||||
s_nCurrIdx = nIdx
|
||||
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
s_vtSlicing = EgtGetInfo( vLayIds[nIdx], KEY_SLICE_DIR, 'v')
|
||||
end
|
||||
|
||||
|
||||
+13
-9
@@ -94,6 +94,10 @@ local function ComputeMultiplanarSlicingData( dSliceStep, nMaxSlicesNbr, nSlicin
|
||||
|
||||
local vSlicingDir = {}
|
||||
local vSlicingPnt = {}
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
dSliceStep = dSliceStep / ( sqrt( 2) / 2)
|
||||
end
|
||||
|
||||
-- ciclo sulla curva
|
||||
local dCrvLen = EgtCurveLength( nSpineId)
|
||||
for i = 0, nMaxSlicesNbr - 1 do
|
||||
@@ -849,7 +853,7 @@ local function SlicingNoSolid( nRibsLay, nSlicingType, dMaxH, dSliceStep, vSlici
|
||||
local dDeltaZ = EgtIf( i == 1, DELTAZ, 0)
|
||||
local ptSlicing
|
||||
local vtSlicing
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
vtSlicing = vtSlicing[i]
|
||||
ptSlicing = vSlicingVal[i]
|
||||
else
|
||||
@@ -864,7 +868,7 @@ local function SlicingNoSolid( nRibsLay, nSlicingType, dMaxH, dSliceStep, vSlici
|
||||
local nResultLay = SliceStm( vIds, nLayId, vtSlicing, ptSlicing, TYPE.RIB, RIBS_CRV, RIBS_GRP, tabParams)
|
||||
|
||||
-- se slicing multplanare verifico altezza massima
|
||||
if ( nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45) and dMaxH < GEO.INFINITO then
|
||||
if ( nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR) and dMaxH < GEO.INFINITO then
|
||||
local b3Box = EgtGetBBoxGlob( nResultLay, GDB_BB.STANDARD)
|
||||
local ptMax = b3Box:getMax() + dSliceStep * vtSlicing
|
||||
if ptMax:getZ() > dMaxH + GEO.EPS_SMALL then
|
||||
@@ -1007,7 +1011,7 @@ local function SlicingWithSolid( nStmId, nSlicingType, dMaxH, vSlicingVal, vSlic
|
||||
|
||||
-- calcolo delle intersezioni
|
||||
local nLayId, nCnt
|
||||
if nSlicingType ~= SLICING_TYPE.MULTIPLANAR and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType ~= SLICING_TYPE.MULTIPLANAR and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_DEG45 and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
if EgtProcessEvents( 1, 0) == 1 then return false end
|
||||
nLayId, nCnt = EgtParPlanesSurfTmInters( ORIG(), vSlicingDir[1], vSlicingVal, nStmId, s_nPartId, GDB_RT.GLOB, TOLER)
|
||||
if EgtProcessEvents( 100, 0) == 1 then return false end
|
||||
@@ -1032,7 +1036,7 @@ local function SlicingWithSolid( nStmId, nSlicingType, dMaxH, vSlicingVal, vSlic
|
||||
local dDeltaZ = EgtIf( nLayCnt == 1, DELTAZ, 0)
|
||||
local ptSlicing
|
||||
local vtSlicing
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
-- nel caso multiplanare sono i dati di slicing
|
||||
vtSlicing = vSlicingDir[nLayCnt]
|
||||
ptSlicing = vSlicingVal[nLayCnt]
|
||||
@@ -1305,7 +1309,7 @@ local function SlicingWithSolid( nStmId, nSlicingType, dMaxH, vSlicingVal, vSlic
|
||||
local bSpiralVase = EgtGetInfo( s_nPartId, KEY_SPIRAL_VASE, 'b') or false
|
||||
if not bSpiralVase then
|
||||
-- infill
|
||||
if nSlicingType ~= SLICING_TYPE.MULTIPLANAR and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType ~= SLICING_TYPE.MULTIPLANAR and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_DEG45 and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
PrepareInfill( nStmId, vSlicingDir[1])
|
||||
end
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( nCnt + 6) / nCounterTot * 100, 0) == 1 then return false end
|
||||
@@ -1318,7 +1322,7 @@ local function SlicingWithSolid( nStmId, nSlicingType, dMaxH, vSlicingVal, vSlic
|
||||
-- solidi ausiliari
|
||||
local nAuxSolidsLay = EgtGetFirstNameInGroup( s_nPartId, LAY_AUX_SOLIDS)
|
||||
SlicingExtraObjects( nAuxSolidsLay, TYPE.AUX_SOLID, AUX_SOLIDS_CRV, AUX_SOLIDS_GRP)
|
||||
if nSlicingType ~= SLICING_TYPE.MULTIPLANAR and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType ~= SLICING_TYPE.MULTIPLANAR and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_DEG45 and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
PrepareAuxSolidsInfill( nAuxSolidsLay, vSlicingDir[1])
|
||||
end
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( nCnt + 12) / nCounterTot * 100, 0) == 1 then return false end
|
||||
@@ -1356,7 +1360,7 @@ local function SlicingWithSolid( nStmId, nSlicingType, dMaxH, vSlicingVal, vSlic
|
||||
end
|
||||
|
||||
-- se multiplanare verifico strand massimo e minimo
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
if not VerifyMultiPlanarStrand() then
|
||||
return false
|
||||
end
|
||||
@@ -1385,7 +1389,7 @@ function CalcSlices.Exec( nPartId, nStmId)
|
||||
vtSlicing = VectorFromSpherical( 1, 45, dHorAng)
|
||||
elseif nSlicingType == SLICING_TYPE.HORIZONTAL then
|
||||
vtSlicing = X_AX()
|
||||
elseif nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
elseif nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
-- la direzione può cambiare da un piano all'altro
|
||||
vtSlicing = Z_AX()
|
||||
end
|
||||
@@ -1433,7 +1437,7 @@ function CalcSlices.Exec( nPartId, nStmId)
|
||||
local dMaxH = ComputeMaxH( vRefIds, vtSlicing, dSliceStep)
|
||||
local vSlicingVal = {}
|
||||
local vSlicingDir = {}
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
vSlicingVal, vSlicingDir = ComputeMultiplanarSlicingData( dSliceStep, nMaxSlicesNbr, nSlicingType)
|
||||
else
|
||||
vSlicingVal, vSlicingDir = ComputeSlicingData( vRefIds, vtSlicing, dSliceStep, dMaxH, nMaxSlicesNbr)
|
||||
|
||||
@@ -100,7 +100,7 @@ local function AddZCorrection( LayerParams)
|
||||
local dCorrZ = 0
|
||||
|
||||
-- se slicing multiplanare vtSlicing cambia ad ogni layer quindi la correzione deve essere calcolata sul singolo layer
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
|
||||
for i = 1, #vLayIds do
|
||||
-- calcolo i valori legati a vtSlicing per il layer corrente
|
||||
@@ -111,10 +111,12 @@ local function AddZCorrection( LayerParams)
|
||||
if not b3Layer:isEmpty() then
|
||||
-- altezza necessaria per lo strand
|
||||
local dHStrand = 0
|
||||
-- nel caso multiplanar con partenza verticale l'altezza necessaria per lo strand non serve perchè l'altezza viene adattata lungo il percorso
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
-- nel caso multiplanar con partenza verticale l'altezza necessaria per lo strand non serve perchè l'altezza viene adattata lungo il percorso
|
||||
-- nel caso multiplanar 45° si considera come altezza strand quella settata nei parametri visto che varia lungo il percorso ( euristico)
|
||||
dHStrand = 0.5 * LayerParams.dStrand * dNxy + LayerParams.dLayHeight * dNz
|
||||
elseif nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
dHStrand = 0.5 * LayerParams.dStrand
|
||||
end
|
||||
-- altezza necessaria per il tool
|
||||
local dHTool = LayerParams.dTDiam / 2 * dNxy
|
||||
@@ -158,13 +160,13 @@ local function AddZCorrection( LayerParams)
|
||||
-- 2) correzione per i wipe
|
||||
-- altezza minima necessaria per i wipe. Se slicing multiplanare l'altezza minima per il wipe cambia ad ogni layer, altrimenti è un valore comune
|
||||
local dHMinWipe
|
||||
if nSlicingType ~= SLICING_TYPE.MULTIPLANAR and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType ~= SLICING_TYPE.MULTIPLANAR and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_DEG45 and nSlicingType ~= SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
local dNxy = sqrt( LayerParams.vtSlicing:getX() * LayerParams.vtSlicing:getX() + LayerParams.vtSlicing:getY() * LayerParams.vtSlicing:getY())
|
||||
dHMinWipe = LayerParams.dTDiam / 2 * dNxy + max( dHBox, 0) + s_dHSafeWipe
|
||||
end
|
||||
|
||||
for i = 1, #vLayIds do
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
local vtSlicing = EgtGetInfo( vLayIds[i], KEY_SLICE_DIR, 'v')
|
||||
local dNxy = sqrt( vtSlicing:getX() * vtSlicing:getX() + vtSlicing:getY() * vtSlicing:getY())
|
||||
dHMinWipe = LayerParams.dTDiam / 2 * dNxy + max( dHBox, 0) + s_dHSafeWipe
|
||||
@@ -2341,7 +2343,7 @@ local function SpiralVaseFull( vLayIds, LayerParams)
|
||||
-- gestione speciale dei primi layers per gestione dell'altezza e feed
|
||||
|
||||
local nSlicingType = EgtGetInfo( s_nPartId, KEY_SLICING_TYPE, 'i')
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
return SpiralVaseFullMultiPlanar( vLayIds, LayerParams)
|
||||
end
|
||||
|
||||
@@ -2757,7 +2759,7 @@ local function SpiralVasePartial( vLayIds, LayerParams)
|
||||
-- la continuità tra i layers viene risolta sul tratto finale del layer percedente
|
||||
|
||||
local nSlicingType = EgtGetInfo( s_nPartId, KEY_SLICING_TYPE, 'i')
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
return SpiralVasePartialMultiPlanar( vLayIds, LayerParams)
|
||||
end
|
||||
|
||||
@@ -2968,7 +2970,7 @@ function CalcToolPath.Exec( nPartId)
|
||||
|
||||
s_nCurrIdx = nIdx
|
||||
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
LayerParams.vtSlicing = EgtGetInfo( vLayIds[nIdx], KEY_SLICE_DIR, 'v')
|
||||
end
|
||||
|
||||
|
||||
@@ -284,6 +284,7 @@ local function CalcSolidGuides( nCrvId, dStrand, nSolidGrp)
|
||||
if bZigZagInfill then
|
||||
nId, nParts = EgtSplitCurveAtCorners( nCopyId, 80)
|
||||
else
|
||||
local nType = EgtGetInfo( nCrvId, KEY_TYPE, 'i')
|
||||
local dLen = EgtCurveLength( nCrvId)
|
||||
if dLen > LEN_REF and nType ~= TYPE.LINK and nType ~= TYPE.COASTING then
|
||||
nParts = EgtClamp( floor( dLen / LEN_REF), 1, 10)
|
||||
@@ -309,7 +310,7 @@ local function CalcSolidGuides( nCrvId, dStrand, nSolidGrp)
|
||||
local vtCurrS = EgtUV( nGuideId, dU, 1, GDB_ID.ROOT)
|
||||
local vtCurrE = EgtUV( nGuideId, dU + 1, -1, GDB_ID.ROOT)
|
||||
local vtNext = EgtUV( nGuideId, dU + 1, 1, GDB_ID.ROOT)
|
||||
if vtPrev * vtCurrS < GEO.EPS_SMALL or vtCurrE * vtNext < GEO.EPS_SMALL then
|
||||
if vtPrev * vtCurrS < GEO.EPS_SMALL and vtCurrE * vtNext < GEO.EPS_SMALL then
|
||||
local nNewId = EgtSplitCurveAtParam( nGuideId, dU + 0.5)
|
||||
table.insert( vGuideIds, nNewId)
|
||||
break
|
||||
@@ -829,7 +830,7 @@ function RunCalcSolids.Exec()
|
||||
local LayerParams = GetLayerParamsForSolidCalc( nPartId)
|
||||
|
||||
-- se slicing multiplanare considero come altezza standard quella massima ammessa
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
local sMachIni = EgtGetCurrMachineDir() .. '\\' .. EgtGetCurrMachineName() .. '.ini'
|
||||
local dMaxFactor = EgtGetNumberFromIni( '3dPrinting', KEY_MAX_STRANDH_FACTOR, 2, sMachIni)
|
||||
s_dMultiPlanarH = min( dMaxFactor, 5) * LayerParams.dLayHeight
|
||||
@@ -864,7 +865,7 @@ function RunCalcSolids.Exec()
|
||||
|
||||
if #vIds > 0 then
|
||||
-- slicing multiplanare
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR then
|
||||
LayerParams.vtSlicing = EgtGetInfo( vLayIds[nIdx], KEY_SLICE_DIR, 'v')
|
||||
|
||||
if LayerParams.bSpiralVase then
|
||||
|
||||
@@ -197,7 +197,7 @@ function RunPrepareExport.Exec()
|
||||
EgtSetStatus( nDestGrp, GDB_ST.OFF)
|
||||
|
||||
-- se multiplanare o spiral vase esporto direttamente i solidi altrimenti esporto le curve che verranno estruse nel visualizzatore
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or bSpiralVase then
|
||||
if nSlicingType == SLICING_TYPE.MULTIPLANAR or nSlicingType == SLICING_TYPE.MULTIPLANAR_DEG45 or nSlicingType == SLICING_TYPE.MULTIPLANAR_HOR or bSpiralVase then
|
||||
GetSolids( vSlices[i], nDestGrp)
|
||||
else
|
||||
CalcCurves( vSlices[i], nDestGrp, vtSlicing, dStrandBase)
|
||||
|
||||
Reference in New Issue
Block a user