3dPrinting :

- correzione a RunPartPositioning.
This commit is contained in:
SaraP
2022-05-10 10:35:39 +02:00
parent 0670c84d25
commit 00b47493aa
+11 -10
View File
@@ -13,11 +13,11 @@ EgtOutLog( ' RunPartPositioning started', 1)
-- Costanti generali
local AMD = require( 'AddManData')
function RunPartPositioning.Exec()
function RunPartPositioning.Exec()
-- Recupero ultimo oggetto selezionato
local nPartId = EgtGetParent(EgtGetParent( EgtGetLastSelectedObj()))
-- verifico sia un pezzo valido
if nPartId then
if nPartId then
local nParentId = EgtGetParent( nPartId)
while nParentId ~= GDB_ID.ROOT do
nPartId = nParentId
@@ -48,7 +48,10 @@ function RunPartPositioning.Exec()
local nLayerId = EgtGetFirstInGroup( nPartId)
EgtSetName( nLayerId, ORIGINAL_SOLID)
end
local nMchGrpId = EgtGetMachGroupId( '3dPrint')
EgtRemoveMachGroup( nMchGrpId or GDB_ID.NULL)
-- Recupero dati tavola (creando gruppo di lavoro temporaneo)
local nQqqId = EgtAddMachGroup( 'qqq')
EgtSetTable( 'Tab')
@@ -56,13 +59,13 @@ function RunPartPositioning.Exec()
dTabX = b3Tab:getDimX()
dTabY = b3Tab:getDimY()
EgtRemoveMachGroup( nQqqId or GDB_ID.NULL)
-- Richiedo coordinata posizionamento pezzo
local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.EXACT)
-- Richiedo coordinata posizionamento pezzo
local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.EXACT)
local dPosX = b3Tab:getDimX() / 2
local dPosY = b3Tab:getDimY() / 2
local Positions = EgtDialogBox( 'Part position on table:', { 'X', EgtNumToString( EgtToUiUnits(dPosX), 1)}, { 'Y', EgtNumToString( EgtToUiUnits(dPosY), 1)})
if not Positions then return end
if not Positions then return end
dPosX = EgtFromUiUnits( tonumber( Positions[1])) - b3Part:getDimX() / 2
dPosY = EgtFromUiUnits( tonumber( Positions[2])) - b3Part:getDimY() / 2
@@ -86,8 +89,6 @@ function RunPartPositioning.Exec()
-- Posiziono il pezzo
EgtMove( nPartId, Point3d( dPosX, dPosY, 0) - b3Part:getMin())
local nMchGrpId = EgtGetMachGroupId( '3dPrint')
EgtRemoveMachGroup( nMchGrpId or GDB_ID.NULL)
EgtAddMachGroup( '3dPrint')
EgtSetTable( 'Tab')
@@ -99,7 +100,7 @@ function RunPartPositioning.Exec()
EgtSetView( SCE_VD.ISO_SW, false)
EgtZoom( SCE_ZM.ALL)
EgtOutLog( ' +++ PlacePart completed')