EgwWindowLua :
- correzioni e migliorie varie.
This commit is contained in:
@@ -76,12 +76,12 @@ end
|
||||
local function TrimSplitWithOutline( nSplitId)
|
||||
-- lo taglio con outline
|
||||
local nStartIntersId = EgtGetInfo( nSplitId, WIN_SPLIT_STARTINTERS, 'i')
|
||||
local nOutlineId = EgtGetInfo( nStartIntersId, WIN_CHILD, 'i')
|
||||
local nOutlineId = EgtGetInfo( nStartIntersId, WIN_COPY, 'i')
|
||||
local ptStartInters = EgtIP( nSplitId, nOutlineId, EgtSP( nSplitId))
|
||||
local dStartInters = EgtCurveParamAtPoint( nSplitId, ptStartInters)
|
||||
EgtTrimCurveStartAtParam( nSplitId, dStartInters)
|
||||
EgtTrimCurveStartAtParam( nSplitId, dStartInters)
|
||||
local nEndIntersId = EgtGetInfo( nSplitId, WIN_SPLIT_ENDINTERS, 'i')
|
||||
nOutlineId = EgtGetInfo( nEndIntersId, WIN_CHILD, 'i')
|
||||
nOutlineId = EgtGetInfo( nEndIntersId, WIN_COPY, 'i')
|
||||
local ptEndInters = EgtIP( nSplitId, nOutlineId, EgtSP( nSplitId))
|
||||
local dEndInters = EgtCurveParamAtPoint( nSplitId, ptEndInters)
|
||||
EgtTrimCurveEndAtParam( nSplitId, dEndInters)
|
||||
@@ -428,16 +428,10 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
|
||||
EgtRemoveInfo( nSplitId, WIN_SOU)
|
||||
-- lo taglio con outline
|
||||
TrimSplitWithOutline( nSplitId)
|
||||
-- recupero tipo di profilo
|
||||
local sSplitProfile = EgtGetInfo( nSplitId, WIN_PROFILETYPE)
|
||||
-- se split interno ad anta
|
||||
local nParentAreaId = EgtGetParent( nAreaId)
|
||||
local nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i')
|
||||
while nParentAreaType ~= WIN_AREATYPES.FRAME and nParentAreaType ~= WIN_AREATYPES.SASH do
|
||||
nParentAreaId = EgtGetParent( nParentAreaId)
|
||||
nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i')
|
||||
end
|
||||
if nParentAreaType == WIN_AREATYPES.SASH then
|
||||
-- recupero tipo di profilo
|
||||
local sSplitProfile = EgtGetInfo( nSplitId, WIN_PROFILETYPE)
|
||||
if sSplitProfile == WIN_SASH_SPLIT then
|
||||
-- recupero profilo usato per anta
|
||||
local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE)
|
||||
local nSashProfileLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_SASH)
|
||||
@@ -448,7 +442,7 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
|
||||
EgtMove( nSplitId, Z_AX() * dSashZOffset)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- SASH
|
||||
elseif nAreaType == WIN_AREATYPES.SASH then
|
||||
@@ -745,19 +739,14 @@ local function GetProfileCtrIn( nProfileType, nPrevOutlineId, nOutlineId, nPrevP
|
||||
local sPrevCtrIn = WIN_CTRIN
|
||||
-- gestione particolare nel caso di split su split
|
||||
if nProfileType == WIN_PRF.SPLIT then
|
||||
-- verifico se il prev e' uno split
|
||||
-- recupero il base outline corrispondente e verifico se un suo sou è split
|
||||
-- recupero il base outline del prev e verifico se deriva da uno split
|
||||
local nPrevSouId = EgtGetInfo( nPrevOutlineId, WIN_COPY, 'i')
|
||||
local nPrevSouParentId
|
||||
local sPrevSouParentId
|
||||
local sPrevSouName
|
||||
repeat
|
||||
nPrevSouId = EgtGetInfo( nPrevSouId, WIN_SOU, 'i')
|
||||
if nPrevSouId then
|
||||
nPrevSouParentId = EgtGetParent( nPrevSouId)
|
||||
sPrevSouParentId = EgtGetName( nPrevSouParentId)
|
||||
end
|
||||
until not nPrevSouId or sPrevSouParentId == WIN_BASESPLIT
|
||||
if nPrevSouId and sPrevSouParentId == WIN_BASESPLIT then
|
||||
sPrevSouName = EgtGetName( nPrevSouId or GDB_ID.NULL)
|
||||
until not nPrevSouId or sPrevSouName == WIN_SPLIT
|
||||
if sPrevSouName == WIN_SPLIT then
|
||||
-- verifico da che lato sono dello split
|
||||
local dOutlineDist, _, dSide = EgtPointCurveDistSide( EgtMP( nOutlineId), nPrevSouId, Z_AX())
|
||||
-- recupero box dei controprofili rispetto al loro sistema di riferimento
|
||||
@@ -930,10 +919,8 @@ local function CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId, bBottomRail)
|
||||
local nEndPartJointType = CalcPartJointType( nProfileType, nEndJointType)
|
||||
|
||||
-- salvo i valori joint su outline per disegno solido
|
||||
if nProfileType ~= WIN_PRF.BOTTOMRAIL then
|
||||
EgtSetInfo( nOutlineId, WIN_STARTJOINT, nStartPartJointType)
|
||||
EgtSetInfo( nOutlineId, WIN_ENDJOINT, nEndPartJointType)
|
||||
end
|
||||
EgtSetInfo( nOutlineId, WIN_STARTJOINT, nStartPartJointType)
|
||||
EgtSetInfo( nOutlineId, WIN_ENDJOINT, nEndPartJointType)
|
||||
|
||||
-- creo lati dell'outline
|
||||
local nGeoOutId = CreateFrameGeo( nOutlineId, nPrevOutlineId, nNextOutlineId, nStartPartJointType, nEndPartJointType, nProfileType, nGeoLayerId, bBottomRail)
|
||||
@@ -974,11 +961,6 @@ local function CalcStartEndProfileType( nProfileType, nOutlineId, nStartProfileI
|
||||
sEndProfileType = GetProfileCtrIn( nProfileType, nEndId, nOutlineId, nEndProfileId)
|
||||
sStartProfileType = WIN_OFST .. sStartProfileType
|
||||
sEndProfileType = WIN_OFST .. sEndProfileType
|
||||
elseif nProfileType == WIN_PRF.BOTTOMRAIL then
|
||||
StartJointType = WIN_JNT.FULL_V
|
||||
EndJointType = WIN_JNT.FULL_V
|
||||
sStartProfileType = WIN_CTRINOFST
|
||||
sEndProfileType = WIN_CTRINOFST
|
||||
end
|
||||
|
||||
return sStartProfileType, sEndProfileType, StartJointType, EndJointType
|
||||
@@ -986,7 +968,7 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function AddStartDowels( nOutlineId, nPrevOutlineId, StartJointType, nMainProfileId, nStartProfileId, nDowelLayerId, nGeoInId, nSolidLayerId,
|
||||
nMainExtrusionId, nStartExtrusionId, nExtrCopyId)
|
||||
nMainExtrusionId, nStartExtrusionId, nExtrCopyId)
|
||||
|
||||
local sOutlineName = EgtGetName( nOutlineId)
|
||||
local sPrevOutlineName = EgtGetName( nPrevOutlineId)
|
||||
@@ -1256,7 +1238,7 @@ local function MakeSolidByExtrusion( nGeoId, nOutlineId, nMainProfileId, nStartP
|
||||
|
||||
-- recupero outline precedente e successivo
|
||||
local nPrevOutlineId, nEndOutlineId = GetPrevNextOutline( nProfileType, nOutlineId, nOutlineLayerId)
|
||||
|
||||
|
||||
-- a) MAIN EXTRUSION
|
||||
-- creo guida Main
|
||||
local nGuideId = EgtCopy( nOutlineId, nSolidLayerId)
|
||||
@@ -1302,27 +1284,24 @@ local function MakeSolidByExtrusion( nGeoId, nOutlineId, nMainProfileId, nStartP
|
||||
-- assegno come riferimento del profilo il punto start dell'outline
|
||||
EgtChangeGroupFrame( nStartProfileId, Frame3d( EgtSP( nStartGuideId), - EgtSV( nStartGuideId)))
|
||||
|
||||
-- se Start e' split verifico se è necessaria inversione del profilo
|
||||
local nStartId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i')
|
||||
local nStartProfileType
|
||||
if nStartId then
|
||||
local nStartAreaId = EgtGetParent( EgtGetParent( nStartId))
|
||||
if nStartAreaId then
|
||||
nStartProfileType = EgtGetInfo( nStartAreaId, WIN_AREATYPE, 'i')
|
||||
end
|
||||
-- verifico se outline è split interno ad area di split per controlli su inversione del profilo
|
||||
local bSplitInsideSplitArea = false
|
||||
if nProfileType == WIN_PRF.SPLIT then
|
||||
local nAreaId = EgtGetParent( EgtGetParent( nOutlineId))
|
||||
local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i')
|
||||
bSplitInsideSplitArea = ( nAreaType == WIN_AREATYPES.SPLIT)
|
||||
end
|
||||
if nProfileType == WIN_PRF.SPLIT and nStartProfileType and nStartProfileType == WIN_AREATYPES.SPLIT then
|
||||
|
||||
if bSplitInsideSplitArea then
|
||||
-- verifico se il suo start deriva da uno split
|
||||
local nStartId = EgtGetInfo( nOutlineId, WIN_SPLIT_STARTINTERS, 'i')
|
||||
local nStartSouId = nStartId
|
||||
local nStartSouLayerId
|
||||
local sStartSouLayer
|
||||
local sStartSouName
|
||||
repeat
|
||||
nStartSouId = EgtGetInfo( nStartSouId, WIN_SOU)
|
||||
nStartSouLayerId = EgtGetParent( nStartSouId)
|
||||
if nStartSouLayerId then
|
||||
sStartSouLayer = EgtGetName( nStartSouLayerId)
|
||||
end
|
||||
until not nStartSouId or not nStartSouLayerId or sStartSouLayer == WIN_BASESPLIT
|
||||
if nStartSouId and nStartSouLayerId and sStartSouLayer == WIN_BASESPLIT then
|
||||
nStartSouId = EgtGetInfo( nStartSouId, WIN_SOU, 'i')
|
||||
sStartSouName = EgtGetName( nStartSouId or GDB_ID.NULL)
|
||||
until not nStartSouId or sStartSouName == WIN_SPLIT
|
||||
if sStartSouName == WIN_SPLIT then
|
||||
-- recupero vettore tangente nel punto medio della curva di contorno
|
||||
local ptMidStart = EgtMP( nStartId)
|
||||
local vtMidStart = EgtMV( nStartId)
|
||||
@@ -1330,7 +1309,7 @@ local function MakeSolidByExtrusion( nGeoId, nOutlineId, nMainProfileId, nStartP
|
||||
local dMidStartOnStartSou = EgtCurveParamAtPoint( nStartSouId, ptMidStart)
|
||||
local vtMidStartSou = EgtUV( nStartSouId, dMidStartOnStartSou, -1)
|
||||
-- se i due vettori non sono orientati nella stessa direzione
|
||||
if not AreSameVectorExact( vtMidStart, vtMidStartSou) then
|
||||
if not AreSameVectorApprox( vtMidStart, vtMidStartSou) then
|
||||
-- ruoto di 180 gradi il profilo
|
||||
local frStartProfileS = EgtFR( nStartProfileFrameId, GDB_ID.ROOT)
|
||||
EgtRotate( nStartProfileId, frStartProfileS:getOrigin(), frStartProfileS:getVersY(), 180, GDB_RT.GLOB)
|
||||
@@ -1339,6 +1318,7 @@ local function MakeSolidByExtrusion( nGeoId, nOutlineId, nMainProfileId, nStartP
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- recupero outline del profilo Start e lo estrudo
|
||||
local nOutStartProfileId
|
||||
if sStartProfileType == WIN_MINIZINKEN then
|
||||
@@ -1378,27 +1358,18 @@ local function MakeSolidByExtrusion( nGeoId, nOutlineId, nMainProfileId, nStartP
|
||||
EgtTransform( EgtGetAllInGroup( nEndProfileId), frEndProfile)
|
||||
-- assegno come riferimento del profilo il punto start dell'outline
|
||||
EgtChangeGroupFrame( nEndProfileId, Frame3d( EgtSP( nEndGuideId), - EgtSV( nEndGuideId)))
|
||||
-- se End e' split, ruoto di 180 gradi il profilo
|
||||
local nEndId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i')
|
||||
local nEndProfileType
|
||||
if nEndId then
|
||||
local nEndAreaId = EgtGetParent( EgtGetParent( nEndId))
|
||||
if nEndAreaId then
|
||||
nEndProfileType = EgtGetInfo( nEndAreaId, WIN_AREATYPE, 'i')
|
||||
end
|
||||
end
|
||||
if nProfileType == WIN_PRF.SPLIT and nEndProfileType and nEndProfileType == WIN_AREATYPES.SPLIT then
|
||||
|
||||
-- verifico se necessario ruotare di 180 gradi il profilo
|
||||
if bSplitInsideSplitArea then
|
||||
-- verifico se end deriva da split
|
||||
local nEndId = EgtGetInfo( nOutlineId, WIN_SPLIT_ENDINTERS, 'i')
|
||||
local nEndSouId = nEndId
|
||||
local nEndSouLayerId
|
||||
local sEndSouLayer
|
||||
local sEndSouName
|
||||
repeat
|
||||
nEndSouId = EgtGetInfo( nEndSouId, WIN_SOU)
|
||||
nEndSouLayerId = EgtGetParent( nEndSouId)
|
||||
if nEndSouLayerId then
|
||||
sEndSouLayer = EgtGetName( nEndSouLayerId)
|
||||
end
|
||||
until not nEndSouId or not nEndSouLayerId or sEndSouLayer == WIN_BASESPLIT
|
||||
if nEndSouId and nEndSouLayerId and sEndSouLayer == WIN_BASESPLIT then
|
||||
sEndSouName = EgtGetName( nEndSouId or GDB_ID.NULL)
|
||||
until not nEndSouId or sEndSouName == WIN_SPLIT
|
||||
if sEndSouName == WIN_SPLIT then
|
||||
-- recupero vettore tangente nel punto medio della curva di contorno
|
||||
local ptMidEnd = EgtMP( nEndId)
|
||||
local vtMidEnd = EgtMV( nEndId)
|
||||
@@ -1406,7 +1377,7 @@ local function MakeSolidByExtrusion( nGeoId, nOutlineId, nMainProfileId, nStartP
|
||||
local dMidStartOnEndSou = EgtCurveParamAtPoint( nEndSouId, ptMidEnd)
|
||||
local vtMidEndSou = EgtUV( nEndSouId, dMidStartOnEndSou, -1)
|
||||
-- se i due vettori non sono orientati nella stessa direzione
|
||||
if not AreSameVectorExact( vtMidEnd, vtMidEndSou) then
|
||||
if not AreSameVectorApprox( vtMidEnd, vtMidEndSou) then
|
||||
-- ruoto di 180 gradi il profilo
|
||||
local frEndProfileS = EgtFR( nEndProfileFrameId, GDB_ID.ROOT)
|
||||
EgtRotate( nEndProfileId, frEndProfileS:getOrigin(), frEndProfileS:getVersY(), 180, GDB_RT.GLOB)
|
||||
@@ -1448,7 +1419,7 @@ local function CalSplitDowel( nSplitLayerId, nOutlineId, nProfileType, nPartId)
|
||||
if not ptInt then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- se interseca, recupero il profilo dello split
|
||||
local nOrigSplitProfileId = GetOutlineProfileId( nSplitId, false)
|
||||
|
||||
@@ -1505,9 +1476,12 @@ local function CalSplitDowel( nSplitLayerId, nOutlineId, nProfileType, nPartId)
|
||||
elseif nProfileType == WIN_PRF.SPLIT then
|
||||
local sProfileType = EgtGetInfo( nOutlineId, WIN_PROFILETYPE)
|
||||
if sProfileType == WIN_SASH_HORIZONTAL then
|
||||
sStart = WIN_DWL_HORIZONTALSPLITPERPSTART
|
||||
sEnd = WIN_DWL_HORIZONTALSPLITPERPEND
|
||||
-- sta sempre leggendo l'informazione corretta? ( cfr dowel per start ed end nella crezione del solido)
|
||||
-- se poggia sul controprofilo CntrIn2 leggo le info dello split orizzontale, altrimenti vanno bene quelle del top
|
||||
-- ( cfr AddStartDowels e AddEndDowels)
|
||||
if AreSamePointApprox( ptInt, EgtSP( nSplitId)) then
|
||||
sStart = WIN_DWL_HORIZONTALSPLITPERPSTART
|
||||
sEnd = WIN_DWL_HORIZONTALSPLITPERPEND
|
||||
end
|
||||
elseif sProfileType == WIN_SASH_VERTICAL then
|
||||
sStart = WIN_DWL_VERTICALSPLITPERPSTART
|
||||
sEnd = WIN_DWL_VERTICALSPLITPERPEND
|
||||
@@ -1880,7 +1854,7 @@ local function CreateStripFromOutline( nAreaId, nOutlineId)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- funzione che cicla ricorsivamente su aree e sottaree per calcolare i pezzi
|
||||
-- funzione che cicla ricorsivamente su aree e sottoaree per calcolare i pezzi
|
||||
local function CalculateAreaParts( nAreaId)
|
||||
|
||||
local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i')
|
||||
|
||||
Reference in New Issue
Block a user