DataWindow :

- gestione zoccoli.
This commit is contained in:
SaraP
2025-03-27 14:33:32 +01:00
parent bcbb7e2e5f
commit 7c859b000b
4 changed files with 231 additions and 99 deletions
+5 -1
View File
@@ -54,6 +54,7 @@ WIN_PRF = {
HORIZONTAL = 6,
SPLIT = 7,
BOTTOMRAIL = 8,
BOTTOMRAIL_FINAL = 9,
}
-- Tipi di split
@@ -179,11 +180,13 @@ WIN_SASH_TOP = 'Sash_Top'
WIN_SASH_BOTTOM = 'Sash_Bottom'
WIN_SASH_VERTICAL = 'Sash_Vertical'
WIN_SASH_HORIZONTAL = 'Sash_Horizontal'
WIN_RAIL_BOTTOM = 'Rail_Bottom'
WIN_FRAME_TOP = 'Frame_Top'
WIN_FRAME_BOTTOM = 'Frame_Bottom'
WIN_FIXED_TOP = 'Fixed_Top'
WIN_FIXED_BOTTOM = 'Fixed_Bottom'
WIN_RAIL_BOTTOM = 'Rail_Bottom'
WIN_RAIL = 'Rail'
WIN_FILL_RAIL = 'Fill_Rail'
WIN_SASH_ACTIVE = 'Sash_Active'
WIN_SASH_INACTIVE = 'Sash_Inactive'
WIN_FRENCH_IN = 'French_In'
@@ -270,6 +273,7 @@ WIN_SASH_BOTTOM_OVERLAP = 'SashBottomOverlap'
WIN_DELTA = 'Delta'
WIN_FILLOVERLAP = 'FillOverlap'
WIN_FILLDELTA = 'FillDelta'
WIN_RAILDELTA = 'RailDelta'
WIN_GAPDELTA = 'GapDelta'
WIN_GAPDELTAZ = 'GapDeltaZ'
WIN_GAPDELTAIN = 'GapDeltaIn'
+195 -67
View File
@@ -83,11 +83,28 @@ local function FindIntersectionPoint( nCrv1, nCrv2, ptRef)
else
EgtExtendCurveEndByLen( nLine, 10000)
end
-- ricavo il punto di riferimento dalla circonferenza
local ptNewRef = EgtIf( nArc == nCrv2, EgtEP( nArc), EgtSP( nArc))
-- trovo l'intersezione tra retta e circonferenza
ptInt = EgtIP( nCircle, nLine, ptNewRef)
-- trovo le intersezioni tra retta e circonferenza
local nId1, nPoints = EgtCurveCurveInters( nCircle, nLine, GDB_ID.ROOT)
if nPoints == 1 then
ptInt = EgtSP( nId1)
EgtErase( nId1)
else
-- conservo quello più vicino al punto di riferimento
local ptInt1 = EgtSP( nId1)
local ptInt2 = EgtSP( nId1 + 1)
local ptNewRef = EgtIf( nArc == nCrv2, EgtEP( nArc), EgtSP( nArc))
local dDist1 = dist( ptNewRef, ptInt1)
local dDist2 = dist( ptNewRef, ptInt2)
if dDist1 < dDist2 + GEO.EPS_SMALL then
ptInt = ptInt1
else
ptInt = ptInt2
end
EgtErase( nId1)
EgtErase( nId1 + 1)
end
EgtErase( nCircle)
-- allungo l'arco per arrivare al punto di intersezione
if nArc == nCrv2 then
EgtModifyCurveEndPoint( nArc, ptInt)
@@ -96,14 +113,14 @@ local function FindIntersectionPoint( nCrv1, nCrv2, ptRef)
end
else
ptInt = EgtIP( nCrv1, nCrv2, ptRef)
ptInt = EgtIP( nCrv1, nCrv2, ORIG())
if not ptInt then
-- tento estendendo le curve
EgtExtendCurveStartByLen( nCrv1, 10000)
EgtExtendCurveEndByLen( nCrv1, 10000)
EgtExtendCurveStartByLen( nCrv2, 10000)
EgtExtendCurveEndByLen( nCrv2, 10000)
ptInt = EgtIP( nCrv1, nCrv2, ptRef)
ptInt = EgtIP( nCrv1, nCrv2, ORIG())
end
end
@@ -164,7 +181,7 @@ end
---------------------------------------------------------------------
-- funzione che data una curva di outline restituisce l'id del suo profilo
local function GetOutlineProfileId( nOutlineId, bUseBottomRail)
local function GetOutlineProfileId( nOutlineId, bForceBottomRail, nProfileType)
-- ciclo fino a trovare il primo parent che abbia un AreaType definito ( frame o sash)
local nParentId = EgtGetParent( nOutlineId)
@@ -186,17 +203,18 @@ local function GetOutlineProfileId( nOutlineId, bUseBottomRail)
-- recupero il nome del profilo
local sProfileName = EgtGetInfo( nOutlineId, WIN_PROFILETYPE)
-- verifico se bottom rail
if bUseBottomRail then
local nOutlineLay = EgtGetFirstNameInGroup( nParentId, WIN_AREAOUTLINE)
local bBottomRail = EgtGetInfo( nOutlineLay, WIN_BOTTOMRAIL, 'b') or false
local sOutlineName = EgtGetName( nOutlineId)
if sOutlineName == WIN_BOTTOM and bBottomRail then
-- allora imposto profilo BottomRail
sProfileName = WIN_RAIL_BOTTOM
-- controlli per bottomrail
if EgtGetName( nOutlineId) == WIN_BOTTOM and bForceBottomRail then
local nBottomRailTot = EgtGetInfo( nOutlineId, WIN_BOTTOMRAIL, 'i') or 0
if nBottomRailTot > 0 then
sProfileName = WIN_FILL_RAIL
end
elseif nProfileType == WIN_PRF.BOTTOMRAIL then
sProfileName = WIN_RAIL
elseif nProfileType == WIN_PRF.BOTTOMRAIL_FINAL then
sProfileName = WIN_FILL_RAIL
end
-- recupero il profilo
return EgtGetFirstNameInGroup( nLayerId, sProfileName)
end
@@ -205,7 +223,8 @@ end
-- funzione che recupera il pezzo associato ad un outline
local function FindAssociatedPart( nOutlineId)
local nPartId = EgtGetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, 'i') or EgtGetInfo( nOutlineId, WIN_REF_PART, 'i')
local nCrvId = nOutlineId
local nPartId = EgtGetInfo( nCrvId, WIN_REF_PART, 'i')
if not nPartId then
-- cerco la prima curva da cui deriva che ha un pezzo associato
local nBaseOutline = EgtGetInfo( nOutlineId, WIN_COPY, 'i')
@@ -216,12 +235,18 @@ local function FindAssociatedPart( nOutlineId)
local sProfileType = EgtGetInfo( nBaseOutline, WIN_PROFILETYPE)
if sProfileType then
-- recupero l'outline associato
local nCrvId = EgtGetInfo( nBaseOutline, WIN_COPY, 'i')
nPartId = EgtGetInfo( nCrvId, WIN_REF_BOTTOMRAIL_PART, 'i') or EgtGetInfo( nCrvId, WIN_REF_PART, 'i')
nCrvId = EgtGetInfo( nBaseOutline, WIN_COPY, 'i')
nPartId = EgtGetInfo( nCrvId, WIN_REF_PART, 'i')
end
end
end
-- verifico se ha bottomrail
local vBottomRailParts = EgtGetInfo( nCrvId, WIN_REF_BOTTOMRAIL_PART, 'vi')
if vBottomRailParts then
nPartId = vBottomRailParts[#vBottomRailParts]
end
return nPartId
end
@@ -509,8 +534,13 @@ local function CalcProfileType( nAreaId)
-- c) se riempimento
elseif nChildrenType == WIN_CHILDREN_TYPES.FILL then
if sName == WIN_BOTTOM then
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FIXED_BOTTOM)
EgtSetInfo( nOutlineLayerId, WIN_BOTTOMRAIL, true)
-- verifico presenza bottomrail
local nBottomRail = EgtGetInfo( nOutlineLayerId, WIN_BOTTOMRAIL, 'i') or 0
if nBottomRail == 0 then
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FIXED_BOTTOM)
else
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_RAIL_BOTTOM)
end
else
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_FIXED_TOP)
end
@@ -700,6 +730,10 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
local nOutlineId = EgtCopyGlob( nAreaOutlineId, nOutlineLayerId)
EgtSetInfo( nAreaOutlineId, WIN_COPY, nOutlineId)
EgtSetInfo( nOutlineId, WIN_COPY, nAreaOutlineId)
-- se bottom riporto informazione dei bottomrail
if EgtGetName( nOutlineId) == WIN_BOTTOM then
CopyInfo( nOutlineId, nOutlineLayerId, WIN_BOTTOMRAIL)
end
nAreaOutlineId = EgtGetNext( nAreaOutlineId)
end
@@ -897,6 +931,7 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
end
local nParentOutlineId = EgtGetInfo( nParentBaseOutlineId, WIN_COPY, 'i')
local nParentProfileId = GetOutlineProfileId( nParentOutlineId, true)
sParentProfile = EgtGetName( nParentProfileId)
-- calcolo il box del riferimento del profilo del frame
local b3FrameProfile = GetProfileLocalBox( nParentProfileId)
@@ -905,10 +940,18 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
local bMixedSplit = ( EgtGetInfo( nParentOutlineId, WIN_PRF_CHANGE, 'b') or false) and EgtGetName( nParentOutlineId) == WIN_SPLIT
local dDimRef = EgtIf( bMixedSplit, b3FrameProfile:getMax():getX(), b3FrameProfile:getMin():getX())
local dFillPerpOffset = abs( dDimRef) - dOverlap
local dFillZOffset = EgtGetInfo( nParentProfileId, WIN_FILLDELTA, 'd')
-- faccio offset e muovo in z
if sParentProfile == WIN_FILL_RAIL then
-- se bottom rail considero la distanza necessaria per il numero di bottomrail richiesti
local nBottomRails = EgtGetInfo( nParentOutlineId, WIN_BOTTOMRAIL, 'i')
local dRailDelta1 = EgtGetInfo( nParentProfileId, WIN_RAILDELTA .. '1', 'd')
local dRailDelta2 = EgtGetInfo( nParentProfileId, WIN_RAILDELTA .. '2', 'd')
dFillPerpOffset = dFillPerpOffset + dRailDelta1 + ( nBottomRails - 1) * dRailDelta2
end
-- faccio offset
EgtOffsetCurve( nOutlineId, - dFillPerpOffset)
-- movimento in z
local dFillZOffset = EgtGetInfo( nParentProfileId, WIN_FILLDELTA, 'd')
EgtMove( nOutlineId, Z_AX() * dFillZOffset)
nBaseOutlineId = EgtGetNext( nBaseOutlineId)
@@ -916,7 +959,7 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
-- accorcio gli offset
TrimAndOrientOrderedCurves( EgtGetAllInGroup( nOutlineLayerId), true)
end
end
---------------------------------------------------------------------
@@ -938,14 +981,26 @@ end
------------------------ FUNZIONI AUX PER CALCOLO PEZZI ------------------------
----------------------------------------------------------------------------------
-- funzione che restituisce il WIN_PRF in base al nome della curva
local function GetOutlineProfileType( nOutlineId, bBottomRail)
local function GetOutlineProfileType( nOutlineId, bForceBottomRail, nBottomRail)
-- ricavo tipo dal nome
local sName = EgtGetName( nOutlineId)
local nProfileType = WIN_PRF.NULL
if sName == WIN_TOP then
nProfileType = WIN_PRF.TOP
elseif sName == WIN_BOTTOM then
nProfileType = EgtIf( bBottomRail, WIN_PRF.BOTTOMRAIL, WIN_PRF.BOTTOM)
local nBottomRailTot = EgtGetInfo( nOutlineId, WIN_BOTTOMRAIL, 'i') or 0
if bForceBottomRail and nBottomRailTot > 0 then
nProfileType = WIN_PRF.BOTTOMRAIL_FINAL
elseif nBottomRail then
-- verifico se bottomrail intermedio o finale
if nBottomRail == nBottomRailTot then
nProfileType = WIN_PRF.BOTTOMRAIL_FINAL
else
nProfileType = WIN_PRF.BOTTOMRAIL
end
else
nProfileType = WIN_PRF.BOTTOM
end
elseif sName == WIN_LEFT then
nProfileType = WIN_PRF.LEFT
elseif sName == WIN_RIGHT then
@@ -1173,7 +1228,7 @@ local function CalcPartJointType( nProfileType, JointType)
if JointType == WIN_JNT.ANGLED then
return WIN_PART_JNT.ANGLED
end
if nProfileType == WIN_PRF.BOTTOMRAIL or nProfileType == WIN_PRF.SPLIT then
if nProfileType == WIN_PRF.BOTTOMRAIL or nProfileType == WIN_PRF.BOTTOMRAIL_FINAL or nProfileType == WIN_PRF.SPLIT then
return WIN_PART_JNT.SHORT
elseif nProfileType == WIN_PRF.BOTTOM or nProfileType == WIN_PRF.TOP then
if JointType == WIN_JNT.FULL_H then
@@ -1190,9 +1245,18 @@ local function CalcPartJointType( nProfileType, JointType)
end
end
---------------------------------------------------------------------
-- funzione che calcola e salva nel profilo il delta del bottomrail corrente rispetto alla sua curva di outline
local function SaveRailDelta( nProfileId, nBottomRail)
local dDelta1 = EgtGetInfo( nProfileId, WIN_RAILDELTA .. '1', 'd')
local dDelta2 = EgtGetInfo( nProfileId, WIN_RAILDELTA .. '2', 'd')
local dOffs = dDelta1 + ( nBottomRail - 1) * dDelta2
EgtSetInfo( nProfileId, WIN_RAILDELTA, dOffs)
end
---------------------------------------------------------------------
-- funzione che crea il gruppo con i profili di un pezzo
local function CalcProfiles( nPartId, nOutlineId, vPrevOutlineId, vNextOutlineId, nProfileType)
local function CalcProfiles( nPartId, nOutlineId, vPrevOutlineId, vNextOutlineId, nProfileType, nBottomRail)
-- creo gruppo per i profili
local nProfileLayerId = EgtGroup( nPartId)
@@ -1200,11 +1264,15 @@ local function CalcProfiles( nPartId, nOutlineId, vPrevOutlineId, vNextOutlineId
EgtSetStatus( nProfileLayerId, GDB_ST.OFF)
-- recupero profilo principale e ne creo copia
local nOrigMainProfileId = GetOutlineProfileId( nOutlineId, nProfileType == WIN_PRF.BOTTOMRAIL)
local nOrigMainProfileId = GetOutlineProfileId( nOutlineId, false, nProfileType)
local nMainProfileId = EgtCopy( nOrigMainProfileId, nProfileLayerId)
local sMainProfileType = EgtGetName( nMainProfileId)
EgtSetInfo( nMainProfileId, WIN_PRF_TYPE, sMainProfileType)
EgtSetName( nMainProfileId, WIN_PRF_MAIN)
-- se bottomrail salvo info per scostamento dall'outline
if sMainProfileType == WIN_FILL_RAIL or sMainProfileType == WIN_RAIL then
SaveRailDelta( nMainProfileId, nBottomRail)
end
-- recupero profili start e ne creo copia
-- se il tipo corrente è split il pezzo va tagliato con il bottomrail, altrimenti con il bottom
@@ -1214,6 +1282,10 @@ local function CalcProfiles( nPartId, nOutlineId, vPrevOutlineId, vNextOutlineId
local sStartProfileType = EgtGetName( nStartProfileId)
EgtSetInfo( nStartProfileId, WIN_PRF_TYPE, sStartProfileType)
EgtSetName( nStartProfileId, WIN_PRF_START)
if sStartProfileType == WIN_FILL_RAIL then
local nBottomRailTot = EgtGetInfo( vPrevOutlineId[i], WIN_BOTTOMRAIL, 'i')
SaveRailDelta( nStartProfileId, nBottomRailTot)
end
end
-- recupero profili end e ne creo copia
@@ -1223,6 +1295,10 @@ local function CalcProfiles( nPartId, nOutlineId, vPrevOutlineId, vNextOutlineId
local sEndProfileType = EgtGetName( nEndProfileId)
EgtSetInfo( nEndProfileId, WIN_PRF_TYPE, sEndProfileType)
EgtSetName( nEndProfileId, WIN_PRF_END)
if sEndProfileType == WIN_FILL_RAIL then
local nBottomRailTot = EgtGetInfo( vPrevOutlineId[i], WIN_BOTTOMRAIL, 'i')
SaveRailDelta( nEndProfileId, nBottomRailTot)
end
end
-- recupero le info di pinzaggio dal profilo di estrusione
@@ -1249,6 +1325,12 @@ local function GetDeltaProfile( nProfileId, sCtrIn)
else
dCPDelta = abs( b3CP:getMax():getX())
end
-- se bottomrail considero anche scostamento dall'outline
local sProfileType = EgtGetInfo( nProfileId, WIN_PRF_TYPE)
if sProfileType == WIN_FILL_RAIL then
local dDelta = EgtGetInfo( nProfileId, WIN_RAILDELTA, 'd')
dCPDelta = dCPDelta + dDelta
end
return dCPDelta
end
@@ -1260,7 +1342,13 @@ local function CreateFrameGeo( nOutlineId, vPrevOutlineId, vNextOutlineId, nStar
-- calcolo spostamento della curva iniziale dovuto a posizione riferimento
local b3CurrProfileFrame = GetProfileLocalBox( nCurrProfileId)
local dCurrOffset = b3CurrProfileFrame:getMax():getX()
local sProfileType = EgtGetInfo( nCurrProfileId, WIN_PRF_TYPE)
if sProfileType == WIN_FILL_RAIL or sProfileType == WIN_RAIL then
-- scostamento extra legato al bottomrail
local dDelta = EgtGetInfo( nCurrProfileId, WIN_RAILDELTA, 'd')
dCurrOffset = dCurrOffset - dDelta
end
-- creo copie degli outline e le offsetto opportunamente
-- curva out
local nCurrCurveId = EgtCopy( nOutlineId, nGeoLayerId)
@@ -1357,7 +1445,7 @@ end
---------------------------------------------------------------------
-- funzione che calcola l'ingombro dei pezzi del telaio
local function CalcFrameGeo( nPartId, nOutlineId, nOutlineCrvNbr, nOutlineLayerId, nProfileType)
local function CalcFrameGeo( nPartId, nOutlineId, nOutlineCrvNbr, nOutlineLayerId, nProfileType, nBottomRail)
-- creo layer per ingombro
local nGeoLayerId = EgtGroup( nPartId)
@@ -1371,7 +1459,7 @@ local function CalcFrameGeo( nPartId, nOutlineId, nOutlineCrvNbr, nOutlineLayerI
-- recupero il tipo di giunzioni
local nStartJointType
local nEndJointType
if nProfileType == WIN_PRF.SPLIT or nProfileType == WIN_PRF.BOTTOMRAIL then
if nProfileType == WIN_PRF.SPLIT or nProfileType == WIN_PRF.BOTTOMRAIL or nProfileType == WIN_PRF.BOTTOMRAIL_FINAL then
-- non serve settare dei valori per StartJointType ed EndJointType perchè in CalcPartJointType la loro giunzione viene settata a short
else
-- recupero i joints dal vettore
@@ -1407,12 +1495,12 @@ local function CalcFrameGeo( nPartId, nOutlineId, nOutlineCrvNbr, nOutlineLayerI
-- salvo il valore di start joint su outline per calcolo dowels
-- se bottomrail è sicuramente short quindi non salvo il valore che sovrascriverebbe quello del pezzo bottom ( che potrebbe essere short o full)
if nProfileType ~= WIN_PRF.BOTTOMRAIL then
if nProfileType ~= WIN_PRF.BOTTOMRAIL and nProfileType ~= WIN_PRF.BOTTOMRAIL_FINAL then
EgtSetInfo( nOutlineId, WIN_STARTJOINT, nStartPartJointType)
end
-- creo il gruppo con i profili del pezzo
local nProfileLayerId = CalcProfiles( nPartId, nOutlineId, vPrevOutlineId, vNextOutlineId, nProfileType)
local nProfileLayerId = CalcProfiles( nPartId, nOutlineId, vPrevOutlineId, vNextOutlineId, nProfileType, nBottomRail)
-- creo lati dell'outline
CreateFrameGeo( nOutlineId, vPrevOutlineId, vNextOutlineId, nStartPartJointType, nEndPartJointType, nGeoLayerId, nProfileLayerId)
@@ -2020,6 +2108,12 @@ local function CreateProfileSurf( nOutlineId, nProfileId, sProfileName, dExtraLe
EgtAddCurveCompoLineTg( nGuideId, dExtraLen)
EgtAddCurveCompoLineTg( nGuideId, dExtraLen, false)
end
-- correzione nel caso di bottomrail
local sProfileType = EgtGetInfo( nProfileId, WIN_PRF_TYPE)
if sProfileType == WIN_RAIL or sProfileType == WIN_FILL_RAIL then
local dOffs = EgtGetInfo( nProfileId, WIN_RAILDELTA, 'd')
EgtOffsetCurve( nGuideId, - dOffs)
end
-- verifico se necessaria inversione della guida nel caso sia curva "virtuale" ( ovvero in area null o split) che deriva da pezzo di split
local nRefSplitId = EgtGetInfo( nOutlineId, WIN_REF_SPLIT, 'i')
@@ -2142,6 +2236,13 @@ local function CreateMainSurf( nOutlineId, dExtraLen, nProfileId, sSectionName,
EgtExtendCurveStartByLen( nGuideId, dExtraLen)
EgtExtendCurveEndByLen( nGuideId, dExtraLen)
-- se bottomrail sposto opportunamente l'outline
local sProfileType = EgtGetInfo( nProfileId, WIN_PRF_TYPE)
if sProfileType == WIN_RAIL or sProfileType == WIN_FILL_RAIL then
local dOffs = EgtGetInfo( nProfileId, WIN_RAILDELTA, 'd')
EgtOffsetCurve( nGuideId, -dOffs)
end
-- posiziono il profilo sulla curva guida :
-- recupero il frame del profilo
local nProfileFrameId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME)
@@ -2151,7 +2252,7 @@ local function CreateMainSurf( nOutlineId, dExtraLen, nProfileId, sSectionName,
EgtTransform( EgtGetAllInGroup( nProfileId), frInvert)
-- assegno come riferimento del profilo il punto start dell'outline
EgtChangeGroupFrame( nProfileId, Frame3d( EgtSP( nGuideId), - EgtSV( nGuideId)))
-- recupero outline del profilo Main e lo estrudo
local nSectionId = EgtGetFirstNameInGroup( nProfileId, sSectionName)
local nMainExtrusionId = EgtSurfTmSwept( nLayerId, nSectionId, nGuideId, false, WIN_SURF_APPROX)
@@ -2375,7 +2476,7 @@ local function CreateDowelFrameDest( nRefProfileType, nPrevGeo, nGeo, nRefOutlin
local vtZ
if nRefProfileType == WIN_PRF.TOP then
vtZ = - X_AX()
elseif nRefProfileType == WIN_PRF.BOTTOM or nRefProfileType == WIN_PRF.BOTTOMRAIL then
elseif nRefProfileType == WIN_PRF.BOTTOM or nRefProfileType == WIN_PRF.BOTTOMRAIL or nRefProfileType == WIN_PRF.BOTTOMRAIL_FINAL then
vtZ = X_AX()
elseif nRefProfileType == WIN_PRF.LEFT then
vtZ = - Y_AX()
@@ -2499,16 +2600,18 @@ end
---------------------------------------------------------------------
-- funzione che calcola i dowels tra due pezzi
local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail)
local function CalcDowels( nOrigOutlineId, nOrigPrevOutlineId, bSashOrFrame, nBottomRail)
-- recupero i pezzi
local nPart = EgtGetInfo( nOutlineId, WIN_REF_PART, 'i')
local nPrevPart = EgtGetInfo( nPrevOutlineId, WIN_REF_PART, 'i')
if bBottomRail then
if EgtGetName( nOutlineId) == WIN_BOTTOM then
nPart = EgtGetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, 'i')
local nPart = EgtGetInfo( nOrigOutlineId, WIN_REF_PART, 'i')
local nPrevPart = EgtGetInfo( nOrigPrevOutlineId, WIN_REF_PART, 'i')
if nBottomRail then
if EgtGetName( nOrigOutlineId) == WIN_BOTTOM then
local vParts = EgtGetInfo( nOrigOutlineId, WIN_REF_BOTTOMRAIL_PART, 'vi')
nPart = vParts[nBottomRail]
else
nPrevPart = EgtGetInfo( nPrevOutlineId, WIN_REF_BOTTOMRAIL_PART, 'i')
local vParts = EgtGetInfo( nOrigPrevOutlineId, WIN_REF_BOTTOMRAIL_PART, 'vi')
nPrevPart = vParts[nBottomRail]
end
end
@@ -2521,14 +2624,31 @@ local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail
local nProfileId = EgtGetFirstNameInGroup( nProfileLay, WIN_PRF_MAIN)
local nPrevProfileLay = EgtGetFirstNameInGroup( nPrevPart, WIN_PROFILE)
local nPrevProfileId = EgtGetFirstNameInGroup( nPrevProfileLay, WIN_PRF_MAIN)
-- copio curve outlines
local nOutlineId = EgtCopyGlob( nOrigOutlineId, nLayerId)
local nPrevOutlineId = EgtCopyGlob( nOrigPrevOutlineId, nLayerId)
if nBottomRail then
-- eventuale offset per bottomrail
local dOffs
local nRefCrv
if EgtGetName( nOutlineId) == WIN_BOTTOM then
nRefCrv = nOutlineId
dOffs = EgtGetInfo( nProfileId, WIN_RAILDELTA, 'd')
else
nRefCrv = nPrevOutlineId
dOffs = EgtGetInfo( nPrevProfileId, WIN_RAILDELTA, 'd')
end
EgtOffsetCurve( nRefCrv, - dOffs)
end
-- recupero i geo
local nGeo = EgtGetFirstNameInGroup( nPart, WIN_GEO)
local nPrevGeo = EgtGetFirstNameInGroup( nPrevPart, WIN_GEO)
-- recupero i tipi di profilo
local nPrevProfileType = GetOutlineProfileType( nPrevOutlineId, bBottomRail)
local nProfileType = GetOutlineProfileType( nOutlineId, bBottomRail)
local nPrevProfileType = GetOutlineProfileType( nPrevOutlineId, false, nBottomRail)
local nProfileType = GetOutlineProfileType( nOutlineId, false, nBottomRail)
-- caso particolare del triangolo : se lato top contro bottom il top deve essere gestito come un left/right
if nProfileType == WIN_PRF.TOP and nPrevProfileType == WIN_PRF.BOTTOM then
nProfileType = WIN_PRF.RIGHT
@@ -2547,7 +2667,7 @@ local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail
-- recupero il tipo di giunzione
local nJointType = EgtGetInfo( nOutlineId, WIN_STARTJOINT, 'i')
if bBottomRail then
if nBottomRail then
if EgtGetName( nOutlineId) == WIN_BOTTOM then
nJointType = WIN_PART_JNT.SHORT
else
@@ -2647,7 +2767,7 @@ local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail
if nPrevProfileType == WIN_PRF.BOTTOM then
sLenKey = WIN_DWL_BOTTOM_PARA_LEN
sPrevLenKey = WIN_DWL_BOTTOM_PERP_LEN
elseif nPrevProfileType == WIN_PRF.BOTTOM_RAIL then
elseif nPrevProfileType == WIN_PRF.BOTTOMRAIL or nPrevProfileType == WIN_PRF.BOTTOMRAIL_FINAL then
sLenKey = WIN_DWL_BOTTOMRAIL_PARA_LEN
sPrevLenKey = WIN_DWL_BOTTOMRAIL_PERP_LEN
end
@@ -2709,6 +2829,9 @@ local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail
EgtErase( nTestSurf2)
end
EgtErase( nOutlineId)
EgtErase( nPrevOutlineId)
end
---------------------------------------------------------------------
@@ -2799,7 +2922,7 @@ local function CalcSplitDowels( nSplitId, vOutlines, bStartOrEnd)
if nProfileType == WIN_PRF.BOTTOM then
sSplitLenKey = WIN_DWL_BOTTOM_PARA_LEN
sLenKey = WIN_DWL_BOTTOM_PERP_LEN
elseif nProfileType == WIN_PRF.BOTTOMRAIL then
elseif nProfileType == WIN_PRF.BOTTOMRAIL_FINAL then
sSplitLenKey = WIN_DWL_RAILBOTTOM_PARA_LEN
sLenKey = WIN_DWL_RAILBOTTOM_PERP_LEN
elseif nProfileType == WIN_PRF.SPLIT then
@@ -2880,16 +3003,18 @@ local function CalculateAreaDowels( nAreaId)
local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE)
if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH then
-- verifico se presente bottomrail
local bBottomRail = EgtGetInfo( nOutlineLayerId, WIN_BOTTOMRAIL, 'b') or false
local nBottomRails = EgtGetInfo( nOutlineLayerId, WIN_BOTTOMRAIL, 'i') or 0
-- aggiungo le spine sui pezzi dell'area
local nOutline = EgtGetFirstInGroup( nOutlineLayerId)
local nPrevOutline = EgtGetLastInGroup( nOutlineLayerId)
while nOutline do
-- aggiungo spine su nOutline e nPrevOutline nel loro punto di giunzione
CalcDowels( nOutline, nPrevOutline, nAreaType == WIN_AREATYPES.SASH, false)
CalcDowels( nOutline, nPrevOutline, nAreaType == WIN_AREATYPES.SASH)
-- bottomrail
if bBottomRail and ( EgtGetName( nOutline) == WIN_BOTTOM or EgtGetName( nPrevOutline) == WIN_BOTTOM) then
CalcDowels( nOutline, nPrevOutline, false, true)
if nBottomRails > 0 and ( EgtGetName( nOutline) == WIN_BOTTOM or EgtGetName( nPrevOutline) == WIN_BOTTOM) then
for j = 1, nBottomRails do
CalcDowels( nOutline, nPrevOutline, false, j)
end
end
-- aggiorno per iterazione successiva
nPrevOutline = nOutline
@@ -2970,8 +3095,9 @@ local function CreateStripGuideLines( nOutlineId, nStripId, nProfileId, nSolidLa
-- calcolo BBox
local b3MainStrip = EgtGetBBoxRef( nStripId, GDB_BB.STANDARD, frProfile, GDB_RT.GLOB)
-- calcolo offset per Strip
local dMainStripMinDelta = EgtIf( bMainInvertOffset, - b3MainStrip:getMax():getX(), b3MainStrip:getMin():getX())
local dMainStripMaxDelta = EgtIf( bMainInvertOffset, - b3MainStrip:getMin():getX(), b3MainStrip:getMax():getX())
local dDelta = EgtGetInfo( nProfileId, WIN_RAILDELTA, 'd') or 0
local dMainStripMinDelta = EgtIf( bMainInvertOffset, - b3MainStrip:getMax():getX() + dDelta, b3MainStrip:getMin():getX() - dDelta)
local dMainStripMaxDelta = EgtIf( bMainInvertOffset, - b3MainStrip:getMin():getX() + dDelta, b3MainStrip:getMax():getX() - dDelta)
local nStripMinOffsetId = EgtCopy( nOutlineId, nSolidLayerId)
EgtOffsetCurve( nStripMinOffsetId, dMainStripMinDelta)
@@ -3226,7 +3352,7 @@ end
---------------------------------------------------------------------
-- funzione che calcola l'ingombro dei pezzi del telaio e i loro solidi
local function CreatePartFromOutline( nAreaLayerId, sName, nOutlineId, nOutlineCrvNbr, bBottomRail)
local function CreatePartFromOutline( nAreaLayerId, sName, nOutlineId, nOutlineCrvNbr, nBottomRail)
-- creo pezzo
local nPartId = EgtGroup( GDB_ID.ROOT)
@@ -3241,19 +3367,22 @@ local function CreatePartFromOutline( nAreaLayerId, sName, nOutlineId, nOutlineC
-- creo riferimenti tra pezzo e outline
EgtSetInfo( nPartId, WIN_REF_OUTLINE, nOutlineId)
if bBottomRail then
EgtSetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, nPartId)
if nBottomRail then
-- aggiorno i riferimenti del bottomrail
local vBottomRailParts = EgtGetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, 'vi') or {}
table.insert( vBottomRailParts, nPartId)
EgtSetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, vBottomRailParts)
else
EgtSetInfo( nOutlineId, WIN_REF_PART, nPartId)
end
-- imposto nome del pezzo
local sOutlineName = EgtIf( bBottomRail, WIN_BOTTOMRAIL, EgtGetName( nOutlineId))
local sOutlineName = EgtIf( nBottomRail, WIN_BOTTOMRAIL .. '_' .. tostring( nBottomRail), EgtGetName( nOutlineId))
local sPartName = sName .. '_' .. sOutlineName
EgtSetName( nPartId, sPartName)
-- imposto il colore
if sOutlineName == WIN_BOTTOM or sOutlineName == WIN_TOP or bBottomRail then
if sOutlineName == WIN_BOTTOM or sOutlineName == WIN_TOP or nBottomRail then
EgtSetColor( nPartId, Color3d( 204, 102, 0))
elseif sOutlineName == WIN_RIGHT or sOutlineName == WIN_LEFT then
EgtSetColor( nPartId, Color3d( 251, 128, 4))
@@ -3262,9 +3391,9 @@ local function CreatePartFromOutline( nAreaLayerId, sName, nOutlineId, nOutlineC
end
-- ricavo il tipo di profilo
local nProfileType = GetOutlineProfileType( nOutlineId, bBottomRail)
local nProfileType = GetOutlineProfileType( nOutlineId, false, nBottomRail)
-- disegno ingombro
CalcFrameGeo( nPartId, nOutlineId, nOutlineCrvNbr, nOutlineLayerId, nProfileType)
CalcFrameGeo( nPartId, nOutlineId, nOutlineCrvNbr, nOutlineLayerId, nProfileType, nBottomRail)
-- calcolo eventuali curve ausiliarie per cambio profilo
local bChangeProfile = EgtGetInfo( nOutlineId, WIN_PRF_CHANGE, 'b') or false
if bChangeProfile and nProfileType ~= WIN_PRF.SPLIT then
@@ -3322,11 +3451,10 @@ local function CalculateAreaParts( nAreaId)
-- creo pezzo
CreatePartFromOutline( nAreaId, sName, vOutlines[i], i)
-- se di tipo bottom verifico se ha bottomrail
local sName = EgtGetName( vOutlines[i])
if sName == WIN_BOTTOM then
local bBottomRail = EgtGetInfo( nOutlineLayerId, WIN_BOTTOMRAIL, 'b') or false
if bBottomRail then
CreatePartFromOutline( nAreaId, sName, vOutlines[i], i, true)
if EgtGetName( vOutlines[i]) == WIN_BOTTOM then
local nBottomRail = EgtGetInfo( nOutlineLayerId, WIN_BOTTOMRAIL, 'i') or 0
for j = 1, nBottomRail do
CreatePartFromOutline( nAreaId, sName, vOutlines[i], i, j)
end
end
end
+2 -2
View File
@@ -584,12 +584,12 @@ end
---------------------------------- BOTTOMRAIL ------------------------------------
----------------------------------------------------------------------------------
-- funzione che aggiunge uno zoccolo
function WinCreate.AddBottomRail( nAreaId)
function WinCreate.AddBottomRail( nAreaId, nNbr)
local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i')
if nAreaType == WIN_AREATYPES.FRAME then
-- recupero l'outline bottom
local nBaseOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAOUTLINE)
EgtSetInfo( nBaseOutlineLayerId, WIN_BOTTOMRAIL, 1)
EgtSetInfo( nBaseOutlineLayerId, WIN_BOTTOMRAIL, nNbr)
end
end
+29 -29
View File
@@ -57,7 +57,7 @@ end
----------------------------------------------------------------------------------
local function WinCreate_ImportProfile()
WinCreate.ImportProfile(WDG.PROFILE)
WinCreate.ImportProfile(WDG.PROFILE)
end
_G.WinCreate_ImportProfile = WinCreate_ImportProfile
@@ -79,74 +79,74 @@ _G.WinCreate_AddSash = WinCreate_AddSash
----------------------------------------------------------------------------------
local function WinCreate_AddHardware()
WinCreate.AddHardware(WDG.AREAID, WDG.FAVOURITE, WDG.HANDLE)
WinCreate.AddHardware(WDG.AREAID, WDG.FAVOURITE, WDG.HANDLE)
end
_G.WinCreate_AddHardware = WinCreate_AddHardware
----------------------------------------------------------------------------------
local function WinCreate_AddFill()
WDG.AREAID = WinCreate.AddFill(WDG.AREAID, WDG.FILLTYPE)
WDG.AREAID = WinCreate.AddFill(WDG.AREAID, WDG.FILLTYPE)
end
_G.WinCreate_AddFill = WinCreate_AddFill
----------------------------------------------------------------------------------
local function WinCreate_AddBottomRail()
WinCreate.AddBottomRail(WDG.AREAID)
WinCreate.AddBottomRail(WDG.AREAID, WDG.NBR)
end
_G.WinCreate_AddBottomRail = WinCreate_AddBottomRail
----------------------------------------------------------------------------------
local function WinCreate_AddSplits()
local AreaIndex = 1
while WDG['AREAID' .. AreaIndex] do
WDG['AREAID' .. AreaIndex] = nil
AreaIndex = AreaIndex + 1
end
local PositionList = {}
local PositionIndex = 1
while WDG['POSITION' .. PositionIndex] do
table.insert( PositionList, WDG['POSITION' .. PositionIndex])
PositionIndex = PositionIndex + 1
end
local AreaList = WinCreate.AddSplits(WDG.AREAID, WDG.SPLITORIENTATION, WDG.MEASURETYPE, PositionList, WDG.PROPORTION, WDG.SPLITTYPE)
for AreaIndex = 1, #AreaList do
WDG['AREAID' .. AreaIndex] = AreaList[ AreaIndex]
end
PositionIndex = 1
while WDG['POSITION' .. PositionIndex] do
WDG['POSITION' .. PositionIndex] = nil
PositionIndex = PositionIndex + 1
end
local AreaIndex = 1
while WDG['AREAID' .. AreaIndex] do
WDG['AREAID' .. AreaIndex] = nil
AreaIndex = AreaIndex + 1
end
local PositionList = {}
local PositionIndex = 1
while WDG['POSITION' .. PositionIndex] do
table.insert( PositionList, WDG['POSITION' .. PositionIndex])
PositionIndex = PositionIndex + 1
end
local AreaList = WinCreate.AddSplits(WDG.AREAID, WDG.SPLITORIENTATION, WDG.MEASURETYPE, PositionList, WDG.PROPORTION, WDG.SPLITTYPE)
for AreaIndex = 1, #AreaList do
WDG['AREAID' .. AreaIndex] = AreaList[ AreaIndex]
end
PositionIndex = 1
while WDG['POSITION' .. PositionIndex] do
WDG['POSITION' .. PositionIndex] = nil
PositionIndex = PositionIndex + 1
end
end
_G.WinCreate_AddSplits = WinCreate_AddSplits
----------------------------------------------------------------------------------
local function WinCalculate_SetCalcSolid()
WinCalculate.SetCalcSolid(WDG.VALUE)
WinCalculate.SetCalcSolid(WDG.VALUE)
end
_G.WinCalculate_SetCalcSolid = WinCalculate_SetCalcSolid
----------------------------------------------------------------------------------
local function WinCalculate_SetSimplifiedSolid()
WinCalculate.SetSimplifiedSolid(WDG.VALUE)
WinCalculate.SetSimplifiedSolid(WDG.VALUE)
end
_G.WinCalculate_SetSimplifiedSolid = WinCalculate_SetSimplifiedSolid
----------------------------------------------------------------------------------
local function WinCalculate_CreatePartFromArea()
WinCalculate.CreatePartFromArea(WDG.FRAMEID)
WinCalculate.CreatePartFromArea(WDG.FRAMEID)
end
_G.WinCalculate_CreatePartFromArea = WinCalculate_CreatePartFromArea
----------------------------------------------------------------------------------
local function WinCalculate_AddHardware()
WinCalculate.AddHardware(WDG.FRAMEID)
WinCalculate.AddHardware(WDG.FRAMEID)
end
_G.WinCalculate_AddHardware = WinCalculate_AddHardware
----------------------------------------------------------------------------------
local function WinCreate_GetHardwareOptionPath()
WDG.HWDOPTPATH = WinCalculate.AddHardwareForSash(WDG.AREAID, true)
WDG.HWDOPTPATH = WinCalculate.AddHardwareForSash(WDG.AREAID, true)
end
_G.WinCreate_GetHardwareOptionPath = WinCreate_GetHardwareOptionPath