3dPrinting :

- modificato il modo di definire il punto di partenza
- aggiunto frame del pezzo.
This commit is contained in:
SaraP
2022-05-13 17:21:41 +02:00
parent ae103a814a
commit 67bb98fc29
3 changed files with 37 additions and 18 deletions
+1
View File
@@ -20,6 +20,7 @@ TOOLPATH_GRP = "ToolPath"
LAYER_SRF = "LayerSurf"
SHELL_CRV = "Shell"
INFILL_CRV = "Infill"
FRAME_PART = "FramePart"
MIN_LEN = 1e-3
MIN_AREA = 1e-6
+25 -2
View File
@@ -52,6 +52,13 @@ function RunPartPositioning.Exec()
local nMchGrpId = EgtGetMachGroupId( '3dPrint')
EgtRemoveMachGroup( nMchGrpId or GDB_ID.NULL)
-- rimuovo eventuale frame
local nFrameId = EgtGetFirstNameInGroup( nPartId, FRAME_PART)
if nFrameId then EgtErase( nFrameId) end
-- rimuovo eventuale start point
local nPtStartId = EgtGetFirstNameInGroup( nPartId, KEY_START_POINT)
if nPtStartId then EgtErase( nPtStartId) end
-- Recupero dati tavola (creando gruppo di lavoro temporaneo)
local nQqqId = EgtAddMachGroup( 'qqq')
EgtSetTable( 'Tab')
@@ -87,8 +94,24 @@ function RunPartPositioning.Exec()
end
-- Posiziono il pezzo
EgtMove( nPartId, Point3d( dPosX, dPosY, 0) - b3Part:getMin())
EgtMove( nPartId, Point3d( dPosX, dPosY, 0) - b3Part:getMin())
-- Aggiorno il suo box
b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.EXACT)
-- creo il frame del pezzo
local frPart = Frame3d( b3Part:getCenter() - 0.5 * b3Part:getDimZ() * Z_AX(), Z_AX())
nFrameId = EgtFrame( nPartId, frPart, GDB_RT.GLOB)
if nFrameId then EgtSetName( nFrameId, FRAME_PART) end
-- creo lo start point
local ptStart = b3Part:getCenter() - 0.6 * b3Part:getDimY() * Y_AX() - 0.5 * b3Part:getDimZ() * Z_AX()
nPtStartId = EgtPoint( nPartId, ptStart, GDB_RT.GLOB)
if nPtStartId then
EgtSetName( nPtStartId, KEY_START_POINT)
EgtSetColor( nPtStartId, EgtStdColor( "RED"))
end
EgtAddMachGroup( '3dPrint')
EgtSetTable( 'Tab')
+11 -16
View File
@@ -46,11 +46,7 @@ local function LoadParams( sFile, nPartId)
SetParamInfo( sFile, nParamsGrp, DEFAULT_SECTION, KEY_STRAND, '6.0')
SetParamInfo( sFile, nParamsGrp, DEFAULT_SECTION, KEY_SHELLS_NBR, '3')
SetParamInfo( sFile, nParamsGrp, DEFAULT_SECTION, KEY_OFFSET_SLICE, '0.0')
local sStartPoint = EgtGetStringFromIni( DEFAULT_SECTION, KEY_START_POINT, '0,0', sFile)
local ptStart = EgtGetVal( 'P='..sStartPoint..',0', 'P', 'p')
EgtSetInfo( nParamsGrp, KEY_START_POINT, ptStart)
local sStrandOrder = EgtGetStringFromIni( DEFAULT_SECTION, KEY_PRINT_ORDER, 'InToOut', sFile)
if sStrandOrder == 'OutToIn' then
EgtSetInfo( nParamsGrp, KEY_PRINT_ORDER, PRINT_ORDER.EXT_INT_INF)
@@ -103,7 +99,15 @@ local function LoadParams( sFile, nPartId)
end
SetParamInfo( sFile, nParamsGrp, DEFAULT_SECTION, KEY_LEAD_OUT_TANG_DIST, '0.0')
SetParamInfo( sFile, nParamsGrp, DEFAULT_SECTION, KEY_LEAD_OUT_ORTHO_DIST, '0.0')
SetParamInfo( sFile, nParamsGrp, DEFAULT_SECTION, KEY_OFFSET_LEAD_POINT, '0.0')
SetParamInfo( sFile, nParamsGrp, DEFAULT_SECTION, KEY_OFFSET_LEAD_POINT, '0.0')
-- recupero il punto iniziale e lo salvo tra i parametri
local ptStart = Point3d( 0, 0, 0)
local nPtStartId = EgtGetFirstNameInGroup( nPartId, KEY_START_POINT)
if nPtStartId then
ptStart = EgtSP( nPtStartId, GDB_ID.ROOT)
end
EgtSetInfo( nParamsGrp, KEY_START_POINT, ptStart)
end
@@ -146,19 +150,10 @@ function RunSlicing.Exec()
-- Lettura dei parametri
LoadParams( sParamFile, nPartId)
-- Lettura dati macchina
local sMachIni = EgtGetCurrMachineDir() .. '\\' .. EgtGetCurrMachineName() .. '.ini'
local HMax = tonumber( EgtGetStringFromIni( '3dPrinting', 'HMax', 500, sMachIni))
-- disegno lo start point
local nPntId = EgtGetFirstNameInGroup( nPartId, KEY_START_POINT)
if nPntId then EgtErase( nPntId) end
local nParamsGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, PARAMS_GRP)
local pt = EgtGetInfo( nParamsGrp, KEY_START_POINT, 'p')
nPntId = EgtPoint( nPartId, pt, GDB_RT.GLOB)
EgtSetColor( nPntId, EgtStdColor("RED"))
EgtSetName( nPntId, KEY_START_POINT)
-- Calcolo delle fette
CSLICES.Exec( nPartId, nStmId, HMax)