3dPrinting :

- possibilità di assegnare parametri diversi a costolature diverse.
This commit is contained in:
SaraP
2022-08-02 14:45:44 +02:00
parent 4c90800319
commit 5ccbfd54ec
4 changed files with 296 additions and 161 deletions
+44 -1
View File
@@ -53,15 +53,48 @@ local function ComputeMaxH( nStmId, frSlicing, HMax)
return GEO.INFINITO
end
--------------------------------------------------------------------
local function ReadParam( nId, sKey, sType, table)
local info = EgtGetInfo( nId, sKey, sType) or EgtGetInfo( s_nPartId, sKey, sType)
table[sKey] = info
end
--------------------------------------------------------------------
local function GetRibParams( nId)
local RibParam = {}
ReadParam( nId, KEY_RIBS_SHELLS_NBR, 'i', RibParam)
ReadParam( nId, KEY_RIBS_INVERT_DIR, 'b', RibParam)
ReadParam( nId, KEY_RIBS_LEAD_IN_INVERT, 'b', RibParam)
ReadParam( nId, KEY_RIBS_LEAD_IN_LEN, 'd', RibParam)
ReadParam( nId, KEY_RIBS_LEAD_OUT_INVERT, 'b', RibParam)
ReadParam( nId, KEY_RIBS_LEAD_OUT_LEN, 'd', RibParam)
ReadParam( nId, KEY_RIBS_LEAD_OUT_COASTING, 'd', RibParam)
ReadParam( nId, KEY_RIBS_LEAD_OUT_WIPE, 'd', RibParam)
ReadParam( nId, KEY_RIBS_LEAD_OUT_WIPE_DIR, 'd', RibParam)
-- overlap può essere diverso tra le varie costolature solo se non sono collegate
local bLink = EgtGetInfo( s_nPartId, KEY_RIBS_LINK, 'b') or false
if bLink then
RibParam[ KEY_RIBS_OVERLAP] = EgtGetInfo( s_nPartId, KEY_RIBS_OVERLAP, 'i') -- parametro generico
else
ReadParam( nId, KEY_RIBS_OVERLAP, 'i', RibParam) -- parametro specifico della costolatura
end
return RibParam
end
--------------------------------------------------------------------
local function SlicingRibs( vtSlicing)
local nRibsShells = EgtGetInfo( s_nPartId, KEY_RIBS_SHELLS_NBR, 'i') or 0
if nRibsShells == 0 then return end
-- recupero le superfici che definiscono le nervature
local nRibsLay = EgtGetFirstNameInGroup( s_nPartId, LAY_RIBS)
local vRibsIds = EgtGetAllInGroup( nRibsLay or GDB_ID.NULL)
if not vRibsIds or #vRibsIds == 0 then return end
-- sistemo la direzione normale dei piani
for i = 1, #vRibsIds do
if EgtGetType( vRibsIds[i]) == GDB_TY.SRF_MESH then
@@ -72,6 +105,13 @@ local function SlicingRibs( vtSlicing)
end
end
end
-- recupero i parametri di ogni costolatura
local tabParams = {}
for i = 1, #vRibsIds do
local vRibParams = GetRibParams( vRibsIds[i])
table.insert( tabParams, vRibParams)
end
local nLayId = EgtGetFirstNameInGroup( s_nPartId, SLICE_LAYER .. '*')
while nLayId do
@@ -92,10 +132,13 @@ local function SlicingRibs( vtSlicing)
for nId = nNewId, nNewId + nPntCnt -1 do
EgtErase( nId)
end
-- rinomino le curve e correggo di DeltaZ
-- rinomino le curve, correggo di DeltaZ e assegno parametri
for nId = nNewId + nPntCnt, nNewId + nPntCnt + nCrvCnt - 1 do
EgtSetName( nId, RIBS_CRV .. tostring( i))
EgtMove( nId, - dDeltaZ * vtSlicing)
for sKey, sVal in pairs( tabParams[i]) do
EgtSetInfo( nId, sKey, sVal)
end
end
-- rimuovo superfici
for nId = nNewId + nPntCnt + nCrvCnt, nNewId + nPntCnt + nCrvCnt + nSrfCnt -1 do