diff --git a/Designing/WinConst.lua b/Designing/WinConst.lua index 6ac239f..d6e0798 100644 --- a/Designing/WinConst.lua +++ b/Designing/WinConst.lua @@ -152,11 +152,12 @@ WIN_OPENING_TYPES = { } -- tipi di pezzo -WIN_PART_TYPE = 'PartType' +WIN_PART_TYPE = 'PART_TYPE' WIN_PART_TYPES = { NULL = 0, FILL = 1, BOTTOMRAIL = 2, + STD = 3, } WIN_AREAOUTLINE = 'BaseOutline' @@ -312,6 +313,7 @@ WIN_PRC_OFFY_2 = 'OFFY_2' WIN_PRC_OFFZ_2 = 'OFFZ_2' WIN_PRC_CLAMPV_1 = 'CLAMPV_1' WIN_PRC_CLAMPV_2 = 'CLAMPV_2' +WIN_PRC_ID = 'ID' -- codici WIN_PROFILE_CODES = { @@ -418,6 +420,10 @@ WIN_PRC_SIDETYPE = { LEFT = 'Left', RIGHT = 'Right' } +WIN_PRC_PROFILE_IN = 'PROFILE_IN' +WIN_PRC_PROFILE_OUT = 'PROFILE_OUT' +WIN_PRC_PROFILE_LEFT = 'PROFILE_LEFT' +WIN_PRC_PROFILE_RIGHT = 'PROFILE_RIGHT' -- SPINE diff --git a/Designing/WinLib/WinCalculate.lua b/Designing/WinLib/WinCalculate.lua index 5bcb00e..fe0e58f 100644 --- a/Designing/WinLib/WinCalculate.lua +++ b/Designing/WinLib/WinCalculate.lua @@ -723,16 +723,6 @@ local function CreateProfileSurf( nOutlineId, nProfileId, sSectionName, dExtraLe return CreateProfileSurfById( nOutlineId, nProfileId, nSectionId, dExtraLen, nLayerId) end ---------------------------------------------------------------------- --- funzione che verifica se i due semiprofili coincidono -local function IsSameSemiProfile( nSemiProfile1, nSemiProfile2) - -- TODO al momento controllo che appartengano allo stesso profilo ma non è il controllo ottimale ( profili diversi possono avere semiprofili uguali). - -- Con la gestione delle librerie di semiprofili nella creazione del file dei profili basterà guardare se sono copie dello stesso semiprofilo ( info?) - local sName1 = EgtGetInfo( EgtGetParent( nSemiProfile1), WIN_PROFILETYPE) - local sName2 = EgtGetInfo( EgtGetParent( nSemiProfile2), WIN_PROFILETYPE) - return ( sName1 == sName2 and EgtGetName( nSemiProfile1) == EgtGetName( nSemiProfile2)) -end - ---------------------------------------------------------------------------------- @@ -1502,6 +1492,7 @@ local function CreateOutlinePart( nOutlineId, sName, dDim, nBottomRail) EgtSetInfo( nPartId, WIN_BOTTOMRAIL, nBottomRail) else EgtSetInfo( nOutlineId, WIN_REF_PART, nPartId) + EgtSetInfo( nPartId, WIN_PART_TYPE, WIN_PART_TYPES.STD) end -- imposto nome @@ -3320,6 +3311,7 @@ local function GetProcessingInfoFromSemiProfile( nCrv, nSemiProfile) CopyInfo( nCrv, nSemiProfile, WIN_PRC_OFFL .. '_' .. tostring(j)) CopyInfo( nCrv, nSemiProfile, WIN_PRC_OFFR .. '_' .. tostring(j)) end + CopyInfo( nCrv, nSemiProfile, WIN_PRC_ID) else -- se non ha semiprofilo associato è un taglio EgtSetInfo( nCrv, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.CUT) @@ -3466,55 +3458,71 @@ local function CreateProfilingProcessingCurve( vCrvs, nPrevCrv, nSurfGeo, nProcL for i = 1, #vCrvs do EgtSetInfo( vCrvs[i], WIN_REF_PRC, nCrvId) end + + return nCrvId end --------------------------------------------------------------------- -- funzione che calcola le lavorazioni di profilatura a partire dalle curve del geo -local function CreateProfilingProcessingFromGeo( nGeoLayerId, nSurfGeo, nProcLayerId) +local function CreateProfilingProcessingFromGeo( nGeoLayerId, nSurfGeo, nProcLayerId, nPartId) -- out e in vengono gestite singolarmente, right e left vengono raggruppate in base al semiprofilo -- out local nOut = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_OUT) - CreateProfilingProcessingCurve( { nOut}, nil, nSurfGeo, nProcLayerId) + local nPrcOut = CreateProfilingProcessingCurve( { nOut}, nil, nSurfGeo, nProcLayerId) + local sOutId = EgtGetInfo( nPrcOut, WIN_PRC_ID) + EgtSetInfo( nPartId, WIN_PRC_PROFILE_OUT, sOutId) -- right local vRight = EgtGetNameInGroup( nGeoLayerId, WIN_GEO_RIGHT) local vCurrRight = { vRight[1]} local nSemiProfilePrev = EgtGetInfo( vRight[1], WIN_SEMI_PROFILE, 'i') + local sIdPrev = EgtGetInfo( nSemiProfilePrev or GDB_ID.NULL, WIN_PRC_ID) + local vsRightIds = { sIdPrev} for i = 2, #vRight do local nSemiProfileCurr = EgtGetInfo( vRight[i], WIN_SEMI_PROFILE, 'i') - if nSemiProfilePrev and nSemiProfileCurr and IsSameSemiProfile( nSemiProfilePrev, nSemiProfileCurr) then + local sIdCurr = EgtGetInfo( nSemiProfileCurr or GDB_ID.NULL, WIN_PRC_ID) + if nSemiProfilePrev and nSemiProfileCurr and sIdPrev == sIdCurr then -- se hanno lo stesso semiprofilo vanno gestite insieme table.insert( vCurrRight, vRight[i]) else -- se hanno un diverso semiprofilo calcolo la lavorazione del gruppo associato al semiprofilo precedente e inizio a creare il gruppo del semiprofilo della curva corrente CreateProfilingProcessingCurve( vCurrRight, nOut, nSurfGeo, nProcLayerId) vCurrRight = { vRight[i]} - nSemiProfilePrev = nSemiProfileCurr + table.insert( vsRightIds, sIdCurr) + sIdPrev = sIdCurr end end CreateProfilingProcessingCurve( vCurrRight, nOut, nSurfGeo, nProcLayerId) + EgtSetInfo( nPartId, WIN_PRC_PROFILE_RIGHT, vsRightIds) -- in local nIn = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_IN) - CreateProfilingProcessingCurve( { nIn}, nil, nSurfGeo, nProcLayerId) + local nPrcIn = CreateProfilingProcessingCurve( { nIn}, nil, nSurfGeo, nProcLayerId) + local sInId = EgtGetInfo( nPrcIn, WIN_PRC_ID) + EgtSetInfo( nPartId, WIN_PRC_PROFILE_IN, sInId) -- left local vLeft = EgtGetNameInGroup( nGeoLayerId, WIN_GEO_LEFT) local vCurrLeft = { vLeft[1]} nSemiProfilePrev = EgtGetInfo( vLeft[1], WIN_SEMI_PROFILE, 'i') + sIdPrev = EgtGetInfo( nSemiProfilePrev or GDB_ID.NULL, WIN_PRC_ID) + local vsLeftIds = { sIdPrev} for i = 2, #vLeft do local nSemiProfileCurr = EgtGetInfo( vLeft[i], WIN_SEMI_PROFILE, 'i') - if nSemiProfilePrev and nSemiProfileCurr and IsSameSemiProfile( nSemiProfilePrev, nSemiProfileCurr) then + local sIdCurr = EgtGetInfo( nSemiProfileCurr or GDB_ID.NULL, WIN_PRC_ID) + if nSemiProfilePrev and nSemiProfileCurr and sIdPrev == sIdCurr then table.insert( vCurrLeft, vLeft[i]) else CreateProfilingProcessingCurve( vCurrLeft, nIn, nSurfGeo, nProcLayerId) vCurrLeft = { vLeft[i]} - nSemiProfilePrev = nSemiProfileCurr + table.insert( vsLeftIds, sIdCurr) + sIdPrev = sIdCurr end end CreateProfilingProcessingCurve( vCurrLeft, nIn, nSurfGeo, nProcLayerId) - + EgtSetInfo( nPartId, WIN_PRC_PROFILE_LEFT, vsLeftIds) + end --------------------------------------------------------------------- @@ -3524,7 +3532,7 @@ local function CalcMixedFrameProfilingProcessings( nPartId, nProcLayerId, nGeoLa -- a) lavorazioni profili -- per le lavorazioni dei profili out, left, right e in comune si usano le corrispondenti curve del geo local nGeoArea = EgtGetLastInGroup( nGeoLayerId) - CreateProfilingProcessingFromGeo( nGeoLayerId, nGeoArea, nProcLayerId) + CreateProfilingProcessingFromGeo( nGeoLayerId, nGeoArea, nProcLayerId, nPartId) -- b) lavorazioni per i sottotratti sash e fill -- TO DO ( da capire bene soprattuto nei casi di cambio profilo che coinvolge pezzi distinti) @@ -3551,7 +3559,7 @@ local function CalcMixedSplitProfilingProcessings( nSplitId, nProcLayerId, nGeoL -- a) lavorazione dei profili local nGeoArea = EgtGetLastInGroup( nGeoLayerId) - CreateProfilingProcessingFromGeo( nGeoLayerId, nGeoArea, nProcLayerId) + CreateProfilingProcessingFromGeo( nGeoLayerId, nGeoArea, nProcLayerId, EgtGetParent( nProcLayerId)) -- b) fresature local nMixedIntersGrp = EgtGetFirstNameInGroup( EgtGetParent( nProcLayerId), WIN_MIXED_CURVES) @@ -3605,7 +3613,7 @@ local function CalcProfilingProcessings( nPartId, nOutlineId) end else -- 2) caso standard : costruisco le curve di lavorazione a partire da quelle del geo - CreateProfilingProcessingFromGeo( nGeoLayerId, nSurfGeo, nProcLayerId) + CreateProfilingProcessingFromGeo( nGeoLayerId, nSurfGeo, nProcLayerId, nPartId) end -- calcolo eventuali lavorazioni per strip