DataWindow :
- pezzi con dimensioni variabili ( prima versione).
This commit is contained in:
+43
-109
@@ -222,30 +222,27 @@ end
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che crea il telaio a partire da una specifica geometria ( rettangolo, chamfer...)
|
||||
function WinCreate.CreateFrame( nType, vJoints, vDimensions, nAreaNbr)
|
||||
function WinCreate.CreateFrame( nType, vDimensions, vJoints, vPartsDim, nAreaNbr)
|
||||
|
||||
-- creo gruppo per telaio
|
||||
local nAreaId = EgtGroup( GDB_ID.ROOT)
|
||||
EgtSetName( nAreaId, WIN_AREA .. '(' .. WIN_FRAME .. ')')
|
||||
EgtSetLevel( nAreaId, GDB_LV.SYSTEM)
|
||||
-- imposto il tipo
|
||||
|
||||
-- imposto le info
|
||||
EgtSetInfo( nAreaId, WIN_AREATYPE, WIN_AREATYPES.FRAME)
|
||||
EgtSetInfo( nAreaId, WIN_FRAME_TYPE, nType)
|
||||
EgtSetInfo( nAreaId, WIN_JOINTS, vJoints)
|
||||
EgtSetInfo( nAreaId, WIN_PART_DIM, vPartsDim)
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
|
||||
-- costruisco le curve di outline
|
||||
local nOutlineLayerId = EgtGroup( nAreaId)
|
||||
EgtSetName( nOutlineLayerId, WIN_AREAOUTLINE)
|
||||
if not CreateFrameCurves( nOutlineLayerId, nType, vDimensions) then
|
||||
return
|
||||
end
|
||||
EgtSetInfo( nAreaId, WIN_FRAME_TYPE, nType)
|
||||
-- imposto tipo giunzioni
|
||||
EgtSetInfo( nOutlineLayerId, WIN_JOINTS, vJoints)
|
||||
end
|
||||
|
||||
-- numerazione
|
||||
if nAreaNbr then
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
end
|
||||
|
||||
return nAreaId
|
||||
end
|
||||
|
||||
@@ -253,58 +250,9 @@ end
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-------------------------------------- ANTA --------------------------------------
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che identifica la forma dell'anta/gruppo di ante
|
||||
local function IdentifySashShape( nAreaId, nOutlineLayerId)
|
||||
|
||||
local vOutlines = EgtGetAllInGroup( nOutlineLayerId)
|
||||
local nCompoId = EgtCurveCompo( nOutlineLayerId, vOutlines, false)
|
||||
|
||||
-- verifico se trapezio
|
||||
local bTrap, ptOrig, vtB1, vtE1, vtB2 = EgtCurveIsATrapezoid( nCompoId)
|
||||
if bTrap then
|
||||
-- verifico se rettangolo controllando se lati sono paralleli
|
||||
local vtE2 = vtB1 + vtE1 - vtB2
|
||||
if AreSameOrOppositeVectorApprox( vtE1, vtE2) then
|
||||
EgtSetInfo( nAreaId, WIN_SASH_SHAPE, WIN_SASH_SHAPES.RECT)
|
||||
else
|
||||
EgtSetInfo( nAreaId, WIN_SASH_SHAPE, WIN_SASH_SHAPES.TRAP)
|
||||
end
|
||||
|
||||
else
|
||||
-- verifico se cerchio
|
||||
local bCircle = EgtCurveIsACircle( nCompoId)
|
||||
if bCircle then
|
||||
EgtSetInfo( nAreaId, WIN_SASH_SHAPE, WIN_SASH_SHAPES.CIRCLE)
|
||||
|
||||
-- verifico se forma con arco
|
||||
elseif #vOutlines == 4 and EgtGetType( vOutlines[3]) == GDB_TY.CRV_ARC then
|
||||
local dAngCenter = EgtArcAngCenter( vOutlines[3])
|
||||
if abs( dAngCenter - 180) < GEO.EPS_SMALL then
|
||||
EgtSetInfo( nAreaId, WIN_SASH_SHAPE, WIN_SASH_SHAPES.ROUND_ARC)
|
||||
else
|
||||
if abs( EgtCurveLength( vOutlines[2]) - EgtCurveLength( vOutlines[4])) < GEO.EPS_SMALL then
|
||||
EgtSetInfo( nAreaId, WIN_SASH_SHAPE, WIN_SASH_SHAPES.SEGMENTAL_ARC)
|
||||
else
|
||||
-- verifico se metà di arco a tutto sesto o ribassato
|
||||
if AreSameVectorApprox( EgtEV( vOutlines[2]), EgtSV( vOutlines[3])) or AreSameVectorApprox( EgtEV( vOutlines[3]), EgtSV( vOutlines[4])) then
|
||||
EgtSetInfo( nAreaId, WIN_SASH_SHAPE, WIN_SASH_SHAPES.SEMI_ROUND_ARC)
|
||||
else
|
||||
EgtSetInfo( nAreaId, WIN_SASH_SHAPE, WIN_SASH_SHAPES.SEMI_SEGMENTAL_ARC)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
EgtSetInfo( nAreaId, WIN_SASH_SHAPE, WIN_SASH_SHAPES.GENERIC)
|
||||
end
|
||||
end
|
||||
|
||||
EgtErase( nCompoId)
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che aggiunge una singola anta
|
||||
function WinCreate.AddSash( nParentAreaId, vJoints, nOpeningType, nAreaNbr)
|
||||
function WinCreate.AddSash( nParentAreaId, vJoints, vPartsDim, nOpeningType, nAreaNbr)
|
||||
|
||||
-- se già presente area errore
|
||||
if EgtGetFirstNameInGroup( nParentAreaId, WIN_AREA .. '*') then
|
||||
@@ -314,27 +262,22 @@ function WinCreate.AddSash( nParentAreaId, vJoints, nOpeningType, nAreaNbr)
|
||||
-- creo nuova area
|
||||
local nAreaId = EgtGroup( nParentAreaId)
|
||||
EgtSetName( nAreaId, WIN_AREA .. '(' .. WIN_SASH .. ')')
|
||||
-- imposto il tipo
|
||||
-- imposto le info
|
||||
EgtSetInfo( nAreaId, WIN_AREATYPE, WIN_AREATYPES.SASH)
|
||||
-- copio outline dall'area parent
|
||||
local nOutlineLayerId = CopyParentOutline( nAreaId, nParentAreaId)
|
||||
IdentifySashShape( nAreaId, nOutlineLayerId)
|
||||
EgtSetInfo( nOutlineLayerId, WIN_JOINTS, vJoints)
|
||||
-- imposto apertura se presente
|
||||
if nOpeningType then
|
||||
EgtSetInfo( nAreaId, WIN_OPENING_TYPE, nOpeningType)
|
||||
end
|
||||
-- numerazione
|
||||
if nAreaNbr then
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
EgtSetInfo( nAreaId, WIN_SASH_NBR, 1)
|
||||
end
|
||||
EgtSetInfo( nAreaId, WIN_JOINTS, vJoints)
|
||||
EgtSetInfo( nAreaId, WIN_PART_DIM, vPartsDim)
|
||||
EgtSetInfo( nAreaId, WIN_OPENING_TYPE, nOpeningType)
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
EgtSetInfo( nAreaId, WIN_SASH_NBR, 1)
|
||||
-- copio outline dall'area parent
|
||||
CopyParentOutline( nAreaId, nParentAreaId)
|
||||
|
||||
return nAreaId
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che aggiunge un gruppo di ante
|
||||
function WinCreate.AddSashGroup( nParentAreaId, vMeasureTypes, vDimensions, vJoints, vSashTypes, vOpeningTypes, nAreaNbr, vSashNbrs)
|
||||
function WinCreate.AddSashGroup( nParentAreaId, vMeasureTypes, vDimensions, vJoints, vPartsDim, vSashTypes, vOpeningTypes, nAreaNbr, vSashNbrs)
|
||||
|
||||
-- se già presente sottoarea errore
|
||||
if EgtGetFirstNameInGroup( nParentAreaId, WIN_AREA .. '*') then
|
||||
@@ -342,25 +285,20 @@ function WinCreate.AddSashGroup( nParentAreaId, vMeasureTypes, vDimensions, vJoi
|
||||
end
|
||||
|
||||
-- creo gli split di tipo french
|
||||
local vAreas = WinCreate.AddSplits( nParentAreaId, WIN_SPLITORIENTATION.VERTICAL, vMeasureTypes, vDimensions, true, nAreaNbr)
|
||||
|
||||
-- identifico la forma del gruppo di ante
|
||||
local nAreaSplit = EgtGetParent( vAreas[1])
|
||||
local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaSplit, WIN_AREAOUTLINE)
|
||||
IdentifySashShape( nAreaSplit, nOutlineLayerId)
|
||||
|
||||
local vAreas = WinCreate.AddSplits( nParentAreaId, WIN_SPLITORIENTATION.VERTICAL, vMeasureTypes, vDimensions, {}, true, nAreaNbr)
|
||||
-- trasformo le aree risultanti ( che sono null) nelle aree dell'anta settando le info opportune
|
||||
for i = 1, #vAreas do
|
||||
EgtSetName( vAreas[i], EgtGetName( vAreas[i]) .. '(' .. WIN_SASH .. ')')
|
||||
EgtSetInfo( vAreas[i], WIN_AREATYPE, WIN_AREATYPES.SASH)
|
||||
local nOutlineLayId = EgtGetFirstNameInGroup( vAreas[i], WIN_AREAOUTLINE)
|
||||
EgtSetInfo( nOutlineLayId, WIN_JOINTS, vJoints[i])
|
||||
EgtSetInfo( vAreas[i], WIN_JOINTS, vJoints[i])
|
||||
EgtSetInfo( vAreas[i], WIN_PART_DIM, vPartsDim[i])
|
||||
EgtSetInfo( vAreas[i], WIN_SASHTYPE, vSashTypes[i])
|
||||
EgtSetInfo( vAreas[i], WIN_OPENING_TYPE, vOpeningTypes[i])
|
||||
if vSashNbrs then
|
||||
EgtSetInfo( vAreas[i], WIN_SASH_NBR, vSashNbrs[i])
|
||||
end
|
||||
end
|
||||
|
||||
return vAreas
|
||||
end
|
||||
|
||||
@@ -379,15 +317,12 @@ function WinCreate.AddFill( nParentAreaId, nFillType, nAreaNbr)
|
||||
|
||||
local nAreaId = EgtGroup( nParentAreaId)
|
||||
EgtSetName( nAreaId, WIN_AREA .. '(' .. WIN_FILL .. ')')
|
||||
-- setto le info
|
||||
EgtSetInfo( nAreaId, WIN_AREATYPE, WIN_AREATYPES.FILL)
|
||||
EgtSetInfo( nAreaId, WIN_FILLTYPE, nFillType)
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
-- copio outline dall'area parent
|
||||
CopyParentOutline( nAreaId, nParentAreaId)
|
||||
-- imposto tipo di fill
|
||||
EgtSetInfo( nAreaId, WIN_FILLTYPE, nFillType)
|
||||
-- numerazione
|
||||
if nAreaNbr then
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
end
|
||||
|
||||
return nAreaId
|
||||
end
|
||||
@@ -651,7 +586,7 @@ end
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che crea tagli split multipli
|
||||
function WinCreate.AddSplits( nParentAreaId, nSplitType, vMeasureTypes, vValues, bFrench, nAreaNbr)
|
||||
function WinCreate.AddSplits( nParentAreaId, nSplitType, vMeasureTypes, vValues, vPartsDim, bFrench, nAreaNbr)
|
||||
|
||||
-- se area ha già sottoarea errore
|
||||
if EgtGetFirstNameInGroup( nParentAreaId, WIN_AREA .. '*') then
|
||||
@@ -663,15 +598,18 @@ function WinCreate.AddSplits( nParentAreaId, nSplitType, vMeasureTypes, vValues,
|
||||
|
||||
-- creo area di split
|
||||
local nAreaId = EgtGroup( nParentAreaId)
|
||||
EgtSetInfo( nAreaId, WIN_AREATYPE, WIN_AREATYPES.SPLIT)
|
||||
EgtSetName( nAreaId, WIN_AREA .. '(' .. WIN_SPLIT .. ')')
|
||||
if nAreaNbr then
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
end
|
||||
-- setto le info
|
||||
EgtSetInfo( nAreaId, WIN_AREATYPE, WIN_AREATYPES.SPLIT)
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
EgtSetInfo( nAreaId, WIN_SPLIT_DIR, nSplitType)
|
||||
EgtSetInfo( nAreaId, WIN_MEASURE_TYPE, vMeasureTypes)
|
||||
EgtSetInfo( nAreaId, WIN_MEASURE_VALUE, vValues)
|
||||
EgtSetInfo( nAreaId, WIN_SPLIT_REF_DIM, EgtIf( nSplitType == WIN_SPLITORIENTATION.VERTICAL, b3OutlineLayer:getDimX(), b3OutlineLayer:getDimY()))
|
||||
EgtSetInfo( nAreaId, WIN_PART_DIM, vPartsDim)
|
||||
|
||||
-- copio il contorno dall'area parent
|
||||
CopyParentOutline( nAreaId, nParentAreaId)
|
||||
|
||||
-- creo layer per split
|
||||
local nSplitLayerId = EgtGroup( nAreaId)
|
||||
@@ -680,19 +618,14 @@ function WinCreate.AddSplits( nParentAreaId, nSplitType, vMeasureTypes, vValues,
|
||||
if bFrench then
|
||||
EgtSetInfo( nSplitLayerId, WIN_SPLITTYPE, WIN_SPLITTYPES.FRENCH)
|
||||
end
|
||||
|
||||
-- creo le curve di split
|
||||
local vSplitCurves = CalcSplitCurves( nSplitLayerId, b3OutlineLayer, b3OutlineLayer, nSplitType, vMeasureTypes, vValues)
|
||||
|
||||
-- se non ci sono curve valide cancello tutto ed esco
|
||||
if #vSplitCurves == 0 then
|
||||
-- se non ci sono curve valide cancello tutto ed esco
|
||||
EgtErase( nAreaId)
|
||||
return
|
||||
end
|
||||
|
||||
-- copio il contorno dall'area parent e setto opportune corrispondenze sou/child
|
||||
local nOutlineLayerId = CopyParentOutline( nAreaId, nParentAreaId)
|
||||
|
||||
-- creo le aree generate dagli split
|
||||
local vAreas = CreateAreasFromSplits( nAreaId, vSplitCurves)
|
||||
return vAreas
|
||||
@@ -700,7 +633,7 @@ end
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che crea tagli split grid
|
||||
function WinCreate.AddGridSplits( nParentAreaId, vVertMeasureTypes, vVertValues, vHorizMeasureTypes, vHorizValues, bStartVertical, nAreaNbr)
|
||||
function WinCreate.AddGridSplits( nParentAreaId, vVertMeasureTypes, vVertValues, vHorizMeasureTypes, vHorizValues, bStartVertical, vPartsDim, nAreaNbr)
|
||||
|
||||
local AreaResult = {}
|
||||
|
||||
@@ -711,13 +644,13 @@ function WinCreate.AddGridSplits( nParentAreaId, vVertMeasureTypes, vVertValues,
|
||||
|
||||
-- creo area di split
|
||||
local nAreaId = EgtGroup( nParentAreaId)
|
||||
EgtSetInfo( nAreaId, WIN_AREATYPE, WIN_AREATYPES.SPLIT)
|
||||
EgtSetName( nAreaId, WIN_AREA .. '(' .. WIN_SPLIT .. ')')
|
||||
if nAreaNbr then
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
end
|
||||
-- setto info
|
||||
EgtSetInfo( nAreaId, WIN_AREATYPE, WIN_AREATYPES.SPLIT)
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
EgtSetInfo( nAreaId, WIN_GRID_SPLIT, true)
|
||||
|
||||
EgtSetInfo( nAreaId, WIN_PART_DIM, vPartsDim)
|
||||
|
||||
-- copio il contorno dall'area parent e setto opportune corrispondenze sou/child
|
||||
local nOutlineLayerId = CopyParentOutline( nAreaId, nParentAreaId)
|
||||
local b3OutlineLayer = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD)
|
||||
@@ -799,10 +732,11 @@ end
|
||||
---------------------------------- BOTTOMRAIL ------------------------------------
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che aggiunge uno zoccolo
|
||||
function WinCreate.AddBottomRail( nAreaId, nNbr)
|
||||
function WinCreate.AddBottomRail( nAreaId, nNbr, vDim)
|
||||
local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i')
|
||||
if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH then
|
||||
EgtSetInfo( nAreaId, WIN_BOTTOMRAIL, nNbr)
|
||||
EgtSetInfo( nAreaId, WIN_BOTTOMRAIL .. WIN_PART_DIM, vDim)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user