3dPrinting :
- gestita interruzione degli script.
This commit is contained in:
@@ -2136,7 +2136,7 @@ function CalcPaths.Exec( nPartId)
|
||||
local vLayIds = EgtGetNameInGroup( s_nPartId, SLICE_LAYER.."*")
|
||||
if not vLayIds then
|
||||
EgtOutBox( 'Error no slice', 'PathCalc')
|
||||
return
|
||||
return true
|
||||
end
|
||||
|
||||
-- recupero i parametri per calcolo dei path
|
||||
@@ -2274,9 +2274,11 @@ function CalcPaths.Exec( nPartId)
|
||||
|
||||
if EgtProcessEvents( EgtIf( PRINT, 200, 0) + nIdx / #vLayIds * 100, 0) == 1 then
|
||||
EgtDraw()
|
||||
return
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
+29
-21
@@ -286,13 +286,12 @@ local function ValueInArray( vArr, nValue)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function SlicingNoSolid( nRibsLay, vZSlices, dDeltaZStart, dZmin, frSlicing)
|
||||
local function SlicingNoSolid( nRibsLay, vZSlices, dDeltaZStart, dZmin, frSlicing, vErr)
|
||||
|
||||
local vErr = {}
|
||||
local vtSlicing = frSlicing:getVersZ()
|
||||
|
||||
-- contatore per il calcolo delle intersezioni
|
||||
if EgtProcessEvents( 100, 0) == 1 then return end
|
||||
if EgtProcessEvents( 100, 0) == 1 then return false end
|
||||
|
||||
-- creo i layer dello slicing
|
||||
for i = 1, #vZSlices do
|
||||
@@ -309,17 +308,17 @@ local function SlicingNoSolid( nRibsLay, vZSlices, dDeltaZStart, dZmin, frSlicin
|
||||
local nGrpCrv = EgtGroup( nLayGrp)
|
||||
EgtSetName( nGrpCrv, CONTOUR_GRP .. EgtNumToString( 0))
|
||||
end
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + 20, 0) == 1 then return end
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + 20, 0) == 1 then return false end
|
||||
|
||||
-- slicing dei setti
|
||||
SlicingExtraObjects( vtSlicing, nRibsLay, TYPE.RIB, RIBS_GRP, RIBS_CRV)
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + 100, 0) == 1 then return end
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + 100, 0) == 1 then return false end
|
||||
|
||||
return vErr
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicing)
|
||||
local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicing, vErr)
|
||||
|
||||
-- costanti
|
||||
local TOLER = 0.05
|
||||
@@ -327,14 +326,13 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
|
||||
local BIG_TOLER = 2.0
|
||||
local MIN_LEN = 20.0
|
||||
local MIN_AREA = 25.0
|
||||
|
||||
local vErr = {}
|
||||
|
||||
local vtSlicing = frSlicing:getVersZ()
|
||||
|
||||
-- calcolo delle intersezioni
|
||||
if EgtProcessEvents( 1, 0) == 1 then return end
|
||||
if EgtProcessEvents( 1, 0) == 1 then return false end
|
||||
local nLayId = EgtParPlanesSurfTmInters( ORIG(), vtSlicing, vZSlices, nStmId, s_nPartId, GDB_RT.GLOB, TOLER)
|
||||
if EgtProcessEvents( 100, 0) == 1 then return end
|
||||
if EgtProcessEvents( 100, 0) == 1 then return false end
|
||||
|
||||
local vPrevCen = {}
|
||||
local nLayCnt = 1
|
||||
@@ -574,9 +572,16 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
|
||||
|
||||
-- passo al layer successivo
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + nLayCnt / ( #vZSlices + 3) * 100, 0) == 1 then
|
||||
EgtDraw()
|
||||
return
|
||||
-- elimino i layer non ancora analizzati
|
||||
local nNext = EgtGetNext( nLayId)
|
||||
while nNext do
|
||||
local nCurr = nNext
|
||||
nNext = EgtGetNext( nCurr)
|
||||
EgtErase( nCurr)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
nLayCnt = nLayCnt + 1
|
||||
nLayId = EgtGetNext( nLayId)
|
||||
end
|
||||
@@ -588,14 +593,14 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
|
||||
if nRibsLay then
|
||||
SlicingExtraObjects( vtSlicing, nRibsLay, TYPE.RIB, RIBS_GRP, RIBS_CRV)
|
||||
end
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 1) / ( #vZSlices + 3) * 100, 0) == 1 then return end
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 1) / ( #vZSlices + 3) * 100, 0) == 1 then return false end
|
||||
|
||||
-- solidi per regioni con diverso numero di passate
|
||||
local nShellNbrLay = EgtGetFirstNameInGroup( s_nPartId, LAY_SHELL_NBR)
|
||||
if nShellNbrLay then
|
||||
SlicingExtraObjects( vtSlicing, nShellNbrLay, TYPE.EXTRA_SHELL, SHELL_NBR_GRP, SHELL_NBR_CRV)
|
||||
end
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 2) / ( #vZSlices + 3) * 100, 0) == 1 then return end
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 2) / ( #vZSlices + 3) * 100, 0) == 1 then return false end
|
||||
|
||||
-- solidi ausiliari
|
||||
local nAuxSolidsLay = EgtGetFirstNameInGroup( s_nPartId, LAY_AUX_SOLIDS)
|
||||
@@ -603,10 +608,10 @@ local function SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicin
|
||||
AdjustAuxSolids( nAuxSolidsLay)
|
||||
SlicingExtraObjects( vtSlicing, nAuxSolidsLay, TYPE.AUX_SOLID, AUX_SOLIDS_GRP, AUX_SOLIDS_CRV)
|
||||
end
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 3) / ( #vZSlices + 3) * 100, 0) == 1 then return end
|
||||
if EgtProcessEvents( EgtIf( PRINT, 100, 0) + ( #vZSlices + 3) / ( #vZSlices + 3) * 100, 0) == 1 then return false end
|
||||
end
|
||||
|
||||
return vErr
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -674,19 +679,22 @@ function CalcSlices.Exec( nPartId, nStmId, HMax)
|
||||
|
||||
local vZSlices = ComputeZSlices( dSliceStep, dZmin, dDeltaZStart, dZmax)
|
||||
|
||||
local vErr
|
||||
local vErr = {}
|
||||
local bOk = true
|
||||
if not nStmId then
|
||||
-- caso senza solido e solo setti
|
||||
vErr = SlicingNoSolid( nRibsLay, vZSlices, dDeltaZStart, dZmin, frSlicing)
|
||||
bOk = SlicingNoSolid( nRibsLay, vZSlices, dDeltaZStart, dZmin, frSlicing, vErr)
|
||||
else
|
||||
-- caso con solido
|
||||
vErr = SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicing)
|
||||
bOk = SlicingWithSolid( nStmId, vZSlices, dDeltaZStart, dZmin, frSlicing, vErr)
|
||||
end
|
||||
|
||||
-- eventuale segnalazione errori
|
||||
if vErr and #vErr > 0 then
|
||||
if bOk and #vErr > 0 then
|
||||
EgtOutBox( 'Slicing Error on layers :\n' .. table.concat( vErr, ','), 'SlicingCalc')
|
||||
end
|
||||
|
||||
return bOk
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -1225,7 +1225,7 @@ local function SpiralVase( vLayIds, LayerParams)
|
||||
|
||||
if EgtProcessEvents( EgtIf( PRINT, 300, 0) + nIdx / #vLayIds * 100, 0) == 1 then
|
||||
EgtDraw()
|
||||
return
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1235,6 +1235,7 @@ local function SpiralVase( vLayIds, LayerParams)
|
||||
-- correzione in z
|
||||
AddZCorrection( b3Tot, LayerParams)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -1242,17 +1243,11 @@ function CalcToolPath.Exec( nPartId)
|
||||
|
||||
s_nPartId = nPartId
|
||||
|
||||
-- Verifico il pezzo
|
||||
if not s_nPartId then
|
||||
EgtOutBox( 'Error missing part', 'ToolPathCalc')
|
||||
return
|
||||
end
|
||||
|
||||
-- Recupero i layer da processare
|
||||
local vLayIds = EgtGetNameInGroup( s_nPartId, SLICE_LAYER.."*")
|
||||
if not vLayIds then
|
||||
EgtOutBox( 'Error missing slices', 'ToolPathCalc')
|
||||
return
|
||||
return true
|
||||
end
|
||||
|
||||
-- recupero i parametri per calcolo dei toolpath
|
||||
@@ -1264,8 +1259,7 @@ function CalcToolPath.Exec( nPartId)
|
||||
|
||||
-- caso spiral vase
|
||||
if LayerParams.bSpiralVase then
|
||||
SpiralVase( vLayIds, LayerParams)
|
||||
return
|
||||
return SpiralVase( vLayIds, LayerParams)
|
||||
end
|
||||
|
||||
local b3Tot = BBox3d() -- box dei toolpath
|
||||
@@ -1353,6 +1347,8 @@ function CalcToolPath.Exec( nPartId)
|
||||
-- correzione in z
|
||||
AddZCorrection( b3Tot, LayerParams)
|
||||
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
@@ -367,8 +367,20 @@ function RunCalcSolids.Exec()
|
||||
if ( nIdx % nStep) == 0 then
|
||||
EgtDraw()
|
||||
end
|
||||
|
||||
if EgtProcessEvents( EgtIf( PRINT, 400, 0) + nIdx / #vLayIds * 100, 0) == 1 then
|
||||
return
|
||||
-- se interrompo cancello i solidi realizzati
|
||||
for i = 1, #vLayIds do
|
||||
local vGrpId = EgtGetNameInGroup( vLayIds[i], CONTOUR_GRP .. '*') or {}
|
||||
for j = 1, #vGrpId do
|
||||
local nSolidId = EgtGetNameInGroup( vGrpId[j], SOLID_GRP .. '*') or GDB_ID.NULL
|
||||
EgtErase( nSolidId)
|
||||
end
|
||||
end
|
||||
-- rimuovo info della presenza solidi
|
||||
EgtSetInfo( nPartId, KEY_HAS_SOLIDS, false)
|
||||
EgtDraw()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@ function RunMachParamFromSWCalc.Exec()
|
||||
local dStrand = EgtGetInfo( nPartId, KEY_STRAND, 'd')
|
||||
local dStrandCount = EgtGetInfo( nPartId, KEY_SHELLS_NBR, 'd')
|
||||
-- recupero numero di strati per progress
|
||||
local nLastLayerId = EgtGetLastNameInGroup( nPartId, SLICE_LAYER .. '*')
|
||||
local nLayerQty = EgtGetInfo( nLastLayerId, KEY_SLICE_NBR, 'i')
|
||||
local nLastLayerId = EgtGetLastNameInGroup( nPartId, SLICE_LAYER .. '*') or GDB_ID.NULL
|
||||
local nLayerQty = EgtGetInfo( nLastLayerId, KEY_SLICE_NBR, 'i') or 0
|
||||
-- ciclo sui layer
|
||||
local nLayerIndex = 1
|
||||
local nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) or EgtGetFirstNameInGroup( nPartId, "__" .. SLICE_LAYER .. nLayerIndex)
|
||||
@@ -210,7 +210,11 @@ function RunMachParamFromSWCalc.Exec()
|
||||
EgtSetInfo( nLayerResultId, KEY_MF, dMF)
|
||||
EgtSetInfo( nLayerResultId, KEY_TOTAREA, dTotLayerArea)
|
||||
-- aggiorno interfaccia
|
||||
EgtProcessEvents( 500 + ( nLayerIndex / nLayerQty * 100), 0)
|
||||
if EgtProcessEvents( 500 + ( nLayerIndex / nLayerQty * 100), 0) == 1 then
|
||||
EgtEmptyGroup( nResultLayerId)
|
||||
return
|
||||
end
|
||||
|
||||
nLayerIndex = nLayerIndex + 1
|
||||
nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex) or EgtGetFirstNameInGroup( nPartId, "__" .. SLICE_LAYER .. nLayerIndex)
|
||||
end
|
||||
|
||||
+17
-215
@@ -25,187 +25,6 @@ local CSOLIDS = require( 'RunCalcSolids')
|
||||
_G.package.loaded.CalcToolPath = nil
|
||||
local CTP = require( 'CalcToolPath')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function SetParamInfo( sFile, nParamsGrp, sSection, sKey, sDefaultVal)
|
||||
local sVal = EgtGetStringFromIni( sSection, sKey, sDefaultVal, sFile)
|
||||
EgtSetInfo( nParamsGrp, sKey, sVal)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function LoadParams( sFile, nPartId)
|
||||
|
||||
EgtSetInfo( nPartId, KEY_PARAMS, sFile)
|
||||
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_CALC_SOLIDS, '0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SPIRAL_VASE, '0')
|
||||
|
||||
local sSlicingType = EgtGetStringFromIni( SEC_DEFAULT, KEY_SLICING_TYPE, 'Vertical', sFile)
|
||||
if sSlicingType == 'Horizontal' then
|
||||
EgtSetInfo( nPartId, KEY_SLICING_TYPE, SLICING_TYPE.HORIZONTAL)
|
||||
elseif sSlicingType == 'Deg45X' then
|
||||
EgtSetInfo( nPartId, KEY_SLICING_TYPE, SLICING_TYPE.DEG45_X)
|
||||
elseif sSlicingType == 'Deg45Y' then
|
||||
EgtSetInfo( nPartId, KEY_SLICING_TYPE, SLICING_TYPE.DEG45_Y)
|
||||
else
|
||||
EgtSetInfo( nPartId, KEY_SLICING_TYPE, SLICING_TYPE.VERTICAL)
|
||||
end
|
||||
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SLICE_STEP, '1.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_STRAND, '6.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SHELLS_NBR, '3')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_STRAND_OVERLAP, '0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_OFFSET_SLICE, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_PRINT_ORDER, '1,2,3,4,5,6,7,8')
|
||||
|
||||
local sStrandOrder = EgtGetStringFromIni( SEC_DEFAULT, KEY_STRAND_ORDER, 'InToOut', sFile)
|
||||
if sStrandOrder == 'OutToIn' then
|
||||
EgtSetInfo( nPartId, KEY_STRAND_ORDER, PRINT_ORDER.EXT_INT)
|
||||
else -- 'InToOut'
|
||||
EgtSetInfo( nPartId, KEY_STRAND_ORDER, PRINT_ORDER.INT_EXT)
|
||||
end
|
||||
|
||||
local sStrandDirection = EgtGetStringFromIni( SEC_DEFAULT, KEY_PRINT_DIRECTION, 'CCW', sFile)
|
||||
if sStrandDirection == 'CW' then
|
||||
EgtSetInfo( nPartId, KEY_PRINT_DIRECTION, PRINT_DIRECTION.CW)
|
||||
else -- 'CCW'
|
||||
EgtSetInfo( nPartId, KEY_PRINT_DIRECTION, PRINT_DIRECTION.CCW)
|
||||
end
|
||||
|
||||
local sLinkType = EgtGetStringFromIni( SEC_DEFAULT, KEY_LINK_TYPE, 'None', sFile)
|
||||
if sLinkType == 'None' then
|
||||
EgtSetInfo( nPartId, KEY_LINK_TYPE, LINK_TYPE.NONE)
|
||||
elseif sLinkType == 'BiArc' then
|
||||
EgtSetInfo( nPartId, KEY_LINK_TYPE, LINK_TYPE.BIARC)
|
||||
else -- 'Linear'
|
||||
EgtSetInfo( nPartId, KEY_LINK_TYPE, LINK_TYPE.LINEAR)
|
||||
end
|
||||
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SP_OFFSET_ON_SLICE, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LINK_PARAM, '0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LINK_ZUP, '0')
|
||||
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_FLOOR_NBR, '0')
|
||||
local sFloorInfill = EgtGetStringFromIni( SEC_DEFAULT, KEY_FLOOR_TYPE, 'Offset', sFile)
|
||||
if sFloorInfill == 'ZigZag' then
|
||||
EgtSetInfo( nPartId, KEY_FLOOR_TYPE, INFILL_TYPE.ZIGZAG)
|
||||
else
|
||||
EgtSetInfo( nPartId, KEY_FLOOR_TYPE, INFILL_TYPE.OFFSET)
|
||||
end
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_CEIL_NBR, '0')
|
||||
local sCeilInfill = EgtGetStringFromIni( SEC_DEFAULT, KEY_CEIL_TYPE, 'Offset', sFile)
|
||||
if sCeilInfill == 'ZigZag' then
|
||||
EgtSetInfo( nPartId, KEY_CEIL_TYPE, INFILL_TYPE.ZIGZAG)
|
||||
else
|
||||
EgtSetInfo( nPartId, KEY_CEIL_TYPE, INFILL_TYPE.OFFSET)
|
||||
end
|
||||
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SPEED, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_FEED, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_EXT_FEED, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_INT_FEED, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_INFILL_FEED, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_IN_FEED, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_OUT_FEED, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SUPPORT_FEED, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_G0_FEED, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_MATERIAL, '')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_TOOL_DIAM, '0.0')
|
||||
|
||||
local sLeadInType = EgtGetStringFromIni( SEC_DEFAULT, KEY_LEAD_IN_TYPE, 'None', sFile)
|
||||
if sLeadInType == 'Linear' then
|
||||
EgtSetInfo( nPartId, KEY_LEAD_IN_TYPE, LEAD_TYPE.LINEAR)
|
||||
elseif sLeadInType == 'Arc' then
|
||||
EgtSetInfo( nPartId, KEY_LEAD_IN_TYPE, LEAD_TYPE.ARC)
|
||||
else -- 'None'
|
||||
EgtSetInfo( nPartId, KEY_LEAD_IN_TYPE, LEAD_TYPE.NONE)
|
||||
end
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_IN_TANG_DIST, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_IN_ORTHO_DIST, '0.0')
|
||||
local sLeadOutType = EgtGetStringFromIni( SEC_DEFAULT, KEY_LEAD_OUT_TYPE, 'None', sFile)
|
||||
if sLeadOutType == 'Linear' then
|
||||
EgtSetInfo( nPartId, KEY_LEAD_OUT_TYPE, LEAD_TYPE.LINEAR)
|
||||
elseif sLeadOutType == 'Arc' then
|
||||
EgtSetInfo( nPartId, KEY_LEAD_OUT_TYPE, LEAD_TYPE.ARC)
|
||||
else -- 'None'
|
||||
EgtSetInfo( nPartId, KEY_LEAD_OUT_TYPE, LEAD_TYPE.NONE)
|
||||
end
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_OUT_TANG_DIST, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_LEAD_OUT_ORTHO_DIST, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_OFFSET_LEAD_POINT, '0.0')
|
||||
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_COASTING_LEN, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_COASTING_FEED, '20000.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_WIPE_LEN, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_WIPE_DIR, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_WIPE_FEEDPU, '0.9')
|
||||
|
||||
-- parametri per costolature
|
||||
local sRibType = EgtGetStringFromIni( SEC_DEFAULT, KEY_RIBS_TYPE, 'Internal', sFile)
|
||||
if sRibType == 'External' then
|
||||
EgtSetInfo( nPartId, KEY_RIBS_TYPE, RIB_TYPE.EXTERNAL)
|
||||
elseif sRibType == 'Unbounded' then
|
||||
EgtSetInfo( nPartId, KEY_RIBS_TYPE, RIB_TYPE.UNBOUNDED)
|
||||
elseif sRibType == 'Support' then
|
||||
EgtSetInfo( nPartId, KEY_RIBS_TYPE, RIB_TYPE.SUPPORT)
|
||||
else -- 'Internal'
|
||||
EgtSetInfo( nPartId, KEY_RIBS_TYPE, RIB_TYPE.INTERNAL)
|
||||
end
|
||||
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_OVERLAP, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_SHELLS_NBR, '0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_INVERT_DIR, '0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_INVERT_STRAND_ORDER, '0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_INVERT_ORDER, '0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LINK, '0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_IN_INVERT, '0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_IN_LEN, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_OUT_INVERT, '0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_OUT_LEN, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_OUT_COASTING, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_OUT_WIPE, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_RIBS_LEAD_OUT_WIPE_DIR, '0.0')
|
||||
|
||||
-- parametri per regioni con diverso numero di passate
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SHELL_NBR_DIFF, '0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SHELL_NBR_COASTING, EgtGetInfo( nPartId, KEY_COASTING_LEN, 'd'))
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SHELL_NBR_WIPE, EgtGetInfo( nPartId, KEY_WIPE_LEN, 'd'))
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_SHELL_NBR_WIPE_DIR, '0.0')
|
||||
|
||||
-- parametri per solidi ausiliari
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_OVERLAP, '0')
|
||||
|
||||
local sAuxSolidsInfill = EgtGetStringFromIni( SEC_DEFAULT, KEY_AUX_SOLIDS_INFILL, 'None', sFile)
|
||||
if sAuxSolidsInfill == 'ZigZag' then
|
||||
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_INFILL, INFILL_TYPE.ZIGZAG)
|
||||
elseif sAuxSolidsInfill == 'Offset' then
|
||||
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_INFILL, INFILL_TYPE.OFFSET)
|
||||
else
|
||||
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_INFILL, INFILL_TYPE.NONE)
|
||||
end
|
||||
|
||||
local sAuxSolidsStrandOrder = EgtGetStringFromIni( SEC_DEFAULT, KEY_AUX_SOLIDS_PRINT_ORDER, 'InToOut', sFile)
|
||||
if sAuxSolidsStrandOrder == 'OutToIn' then
|
||||
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_PRINT_ORDER, PRINT_ORDER.EXT_INT)
|
||||
else -- 'InToOut'
|
||||
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_PRINT_ORDER, PRINT_ORDER.INT_EXT)
|
||||
end
|
||||
|
||||
local sAuxSolidsLinkType = EgtGetStringFromIni( SEC_DEFAULT, KEY_AUX_SOLIDS_LINK_TYPE, 'None', sFile)
|
||||
if sAuxSolidsLinkType == 'None' then
|
||||
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_LINK_TYPE, LINK_TYPE.NONE)
|
||||
elseif sAuxSolidsLinkType == 'BiArc' then
|
||||
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_LINK_TYPE, LINK_TYPE.BIARC)
|
||||
else -- 'Linear'
|
||||
EgtSetInfo( nPartId, KEY_AUX_SOLIDS_LINK_TYPE, LINK_TYPE.LINEAR)
|
||||
end
|
||||
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_LINK_PARAM, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_SP_OFFSET, '0.0')
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_COASTING_LEN, EgtGetInfo( nPartId, KEY_COASTING_LEN, 'd'))
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_WIPE_LEN, EgtGetInfo( nPartId, KEY_WIPE_LEN, 'd'))
|
||||
SetParamInfo( sFile, nPartId, SEC_DEFAULT, KEY_AUX_SOLIDS_WIPE_DIR, '0.0')
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function RestoreOriginalPosition( nPartId)
|
||||
if not nPartId then return end
|
||||
@@ -319,39 +138,12 @@ function RunSlicing.Exec()
|
||||
local nShellNbrLay = EgtGetFirstNameInGroup( nPartId, LAY_SHELL_NBR)
|
||||
local nAuxSolidsLay = EgtGetFirstNameInGroup( nPartId, LAY_AUX_SOLIDS)
|
||||
local nStartLayId = EgtGetFirstNameInGroup( nPartId, LAY_MACH_START)
|
||||
|
||||
local sParamFile
|
||||
if not PRINT or PRINT.PROGRAM ~= 1 then
|
||||
--Scelta del file dei parametri
|
||||
local sPrevParamFile = EgtGetInfo( nPartId, KEY_PARAMS)
|
||||
if not sPrevParamFile or not EgtExistsFile( sPrevParamFile) then
|
||||
local sLastParamFile = EgtGetStringFromIni( '3dPrinting', 'ParamFile', '', EgtGetIniFile())
|
||||
local sDir = EgtSplitPath( sLastParamFile)
|
||||
sPrevParamFile = sDir..'*.ini'
|
||||
end
|
||||
sParamFile = EgtFileDialog( true, sPrevParamFile, 'Param Files (*.ini)|*.ini||')
|
||||
if not sParamFile then
|
||||
EgtOutBox( 'No param file selected', 'Warning', 'WARNING')
|
||||
return
|
||||
end
|
||||
EgtWriteStringToIni( '3dPrinting', 'ParamFile', sParamFile, EgtGetIniFile())
|
||||
end
|
||||
|
||||
-- Elimino eventuale precedente file dei risultati
|
||||
if not PRINT or PRINT.PROGRAM ~= 1 then
|
||||
local sResultFile = EgtChangePathExtension( sCurrProjectPath, '.csv')
|
||||
EgtEraseFile( sResultFile)
|
||||
end
|
||||
|
||||
|
||||
-- Elimino eventuale precedente lavorazione
|
||||
EgtSetCurrMachGroup()
|
||||
EgtRemoveAllOperations()
|
||||
EgtResetCurrMachGroup()
|
||||
|
||||
-- Lettura dei parametri
|
||||
if not PRINT or PRINT.PROGRAM ~= 1 then
|
||||
LoadParams( sParamFile, nPartId)
|
||||
end
|
||||
-- Lettura dati macchina
|
||||
local sMachIni = EgtGetCurrMachineDir() .. '\\' .. EgtGetCurrMachineName() .. '.ini'
|
||||
local HMax = tonumber( EgtGetStringFromIni( '3dPrinting', 'HMax', 500, sMachIni))
|
||||
@@ -364,25 +156,34 @@ function RunSlicing.Exec()
|
||||
|
||||
-- Rimozione vecchi TFS
|
||||
RemoveOldTFS()
|
||||
|
||||
|
||||
-- Calcolo delle fette
|
||||
CSLICES.Exec( nPartId, nStmId, HMax)
|
||||
local bOk = CSLICES.Exec( nPartId, nStmId, HMax)
|
||||
EgtDraw()
|
||||
|
||||
-- Calcolo dei percorsi sul centro strand in basso
|
||||
CPATHS.Exec( nPartId)
|
||||
bOk = bOk and CPATHS.Exec( nPartId)
|
||||
EgtDraw()
|
||||
|
||||
-- Calcolo dei percorsi di lavoro
|
||||
CTP.Exec( nPartId)
|
||||
bOk = bOk and CTP.Exec( nPartId)
|
||||
EgtDraw()
|
||||
|
||||
-- Calcolo dei solidi degli strand a partire dai percorsi di lavoro
|
||||
local bCalcSolids = EgtGetInfo( nPartId, KEY_CALC_SOLIDS, 'b')
|
||||
EgtRemoveInfo( nPartId, KEY_HAS_SOLIDS)
|
||||
if bCalcSolids then
|
||||
if bCalcSolids and bOk then
|
||||
CSOLIDS.Exec( nPartId)
|
||||
end
|
||||
|
||||
if not bOk then
|
||||
-- eventuale ripristino posizione originaria
|
||||
RestoreOriginalPosition( nPartId)
|
||||
-- rimozione vecchi conti
|
||||
RemoveOldSlices( nPartId)
|
||||
EgtDraw()
|
||||
return false
|
||||
end
|
||||
|
||||
EgtSetStatus( nSolidLayId, GDB_ST.OFF)
|
||||
EgtSetStatus( nRibsLayId or GDB_ID.NULL, GDB_ST.OFF)
|
||||
@@ -393,7 +194,8 @@ function RunSlicing.Exec()
|
||||
|
||||
-- Aggiorno impostazioni di visibilita' per ShowManager
|
||||
SetViewInfo( bCalcSolids)
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user