3dPrinting :
- in posizionamento pezzo sulla tavola della macchina verifico che la macchina sia per stampa 3d.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
-- RunPartPositioning.lua by Egaltech s.r.l. 2022/05/19
|
||||
-- RunPartPositioning.lua by Egaltech s.r.l. 2022/05/28
|
||||
-- Gestione calcolo disposizione e lavorazioni per stampa 3d
|
||||
-- 2022/03/21 Creazione file
|
||||
|
||||
@@ -13,7 +13,14 @@ EgtOutLog( ' RunPartPositioning started', 1)
|
||||
-- Costanti generali
|
||||
local AMD = require( 'AddManData')
|
||||
|
||||
function RunPartPositioning.Exec()
|
||||
function RunPartPositioning.Exec()
|
||||
-- Verifico che la macchina corrente sia adatta alla stampa 3d
|
||||
local sMachIni = EgtGetCurrMachineDir() .. '\\' .. EgtGetCurrMachineName() .. '.ini'
|
||||
local sMachMaterial = EgtGetStringFromIni( 'General', 'Material', '', sMachIni)
|
||||
if sMachMaterial ~= 'Additive' then
|
||||
EgtOutBox( 'Current machine unsuitable for additive manufacturing', 'Warning', 'WARNING')
|
||||
return
|
||||
end
|
||||
-- Recupero ultimo oggetto selezionato
|
||||
local nPartId = EgtGetParent(EgtGetParent( EgtGetLastSelectedObj()))
|
||||
-- verifico sia un pezzo valido
|
||||
@@ -48,11 +55,11 @@ function RunPartPositioning.Exec()
|
||||
local nLayerId = EgtGetFirstInGroup( nPartId)
|
||||
EgtSetName( nLayerId, ORIGINAL_SOLID)
|
||||
end
|
||||
|
||||
|
||||
local nMchGrpId = EgtGetMachGroupId( '3dPrint')
|
||||
EgtRemoveMachGroup( nMchGrpId or GDB_ID.NULL)
|
||||
|
||||
-- rimuovo eventuale frame
|
||||
|
||||
-- Rimuovo eventuale frame
|
||||
local nFrameId = EgtGetFirstNameInGroup( nPartId, FRAME_PART)
|
||||
if nFrameId then EgtErase( nFrameId) end
|
||||
-- rimuovo eventuale start point
|
||||
@@ -67,7 +74,7 @@ function RunPartPositioning.Exec()
|
||||
dTabY = b3Tab:getDimY()
|
||||
EgtRemoveMachGroup( nQqqId or GDB_ID.NULL)
|
||||
|
||||
-- Richiedo coordinata posizionamento pezzo
|
||||
-- Richiedo coordinata posizionamento pezzo
|
||||
local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.EXACT)
|
||||
local dPosX = b3Tab:getDimX() / 2
|
||||
local dPosY = b3Tab:getDimY() / 2
|
||||
@@ -81,7 +88,7 @@ function RunPartPositioning.Exec()
|
||||
if not nTabPart then
|
||||
-- Disegno tavola
|
||||
nTabPart = EgtGroup( GDB_ID.ROOT)
|
||||
--EgtSetLevel( nTabPart, GDB_LV.SYSTEM)
|
||||
EgtSetMode( nTabPart, GDB_MD.LOCKED)
|
||||
EgtSetName( nTabPart, TABLE)
|
||||
local nTabLayer = EgtGroup( nTabPart)
|
||||
EgtSetName( nTabLayer, TABLE)
|
||||
@@ -93,15 +100,18 @@ function RunPartPositioning.Exec()
|
||||
EgtSetAlpha( nTabSurfId, 70)
|
||||
end
|
||||
|
||||
-- Posiziono il pezzo
|
||||
EgtMove( nPartId, Point3d( dPosX, dPosY, 0) - b3Part:getMin())
|
||||
-- Aggiorno il suo box
|
||||
b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.EXACT)
|
||||
-- Posiziono il pezzo e aggiorno il suo box
|
||||
local vtMove = Point3d( dPosX, dPosY, 0) - b3Part:getMin()
|
||||
EgtMove( nPartId, vtMove)
|
||||
b3Part:move( vtMove)
|
||||
|
||||
-- creo il frame del pezzo
|
||||
-- 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
|
||||
if nFrameId then
|
||||
EgtSetName( nFrameId, FRAME_PART)
|
||||
EgtSetMode( nFrameId, GDB_MD.LOCKED)
|
||||
end
|
||||
|
||||
EgtAddMachGroup( '3dPrint')
|
||||
EgtSetTable( 'Tab')
|
||||
@@ -121,10 +131,8 @@ function RunPartPositioning.Exec()
|
||||
|
||||
EgtSetView( SCE_VD.ISO_SW, false)
|
||||
EgtZoom( SCE_ZM.ALL)
|
||||
|
||||
|
||||
EgtOutLog( ' +++ PlacePart completed')
|
||||
|
||||
EgtOutLog( ' +++ RunPartPositioning completed')
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user