DataWindow :
- correzioni e migliorie varie sulla ferramenta - sistemazioni varie per alzante scorrevole.
This commit is contained in:
+20
-4
@@ -19,7 +19,7 @@ local WinConst = {}
|
||||
------------------------------------------- PARAMETERS -------------------------------------------
|
||||
|
||||
-- tipi di telaio
|
||||
WIN_FRAME_TYPE = {
|
||||
WIN_FRAME_TYPES = {
|
||||
RECT = 1,
|
||||
CHAMFER_SIDE = 2,
|
||||
CHAMFER = 3,
|
||||
@@ -68,6 +68,7 @@ WIN_FRAME = 'Frame'
|
||||
WIN_SASH = 'Sash'
|
||||
WIN_FILL = 'Fill'
|
||||
WIN_SPLIT = 'Split'
|
||||
WIN_FRAME_TYPE = 'FrameType'
|
||||
|
||||
-- tipo di Area
|
||||
WIN_AREATYPE = 'AreaType'
|
||||
@@ -163,6 +164,7 @@ WIN_SPLIT_ENDINTERS = 'SplitEndInters'
|
||||
WIN_SASH_CHILDREN = 'SashChildren'
|
||||
WIN_FILL_CHILDREN = 'FillChildren'
|
||||
WIN_THRESHOLD_PROFILE = 'ThresholdProfile'
|
||||
WIN_SLIDE_WINDOW = 'SlideWindow'
|
||||
|
||||
|
||||
-- PROFILI
|
||||
@@ -196,6 +198,7 @@ WIN_FRENCH_OUT = 'French_Out'
|
||||
WIN_SASH_SPLIT = 'Sash_Split'
|
||||
|
||||
WIN_SLIDE = 'Slide'
|
||||
WIN_MOVABLE = 'Movable'
|
||||
WIN_SLIDE_MOVABLEBACK = 'Slide_MovableBack'
|
||||
WIN_SLIDE_TOP = 'Slide_Top'
|
||||
WIN_SLIDE_BOTTOM = 'Slide_Bottom'
|
||||
@@ -203,10 +206,13 @@ WIN_SLIDE_MOVABLE = 'Slide_Movable'
|
||||
WIN_SLIDE_FIXED = 'Slide_Fixed'
|
||||
WIN_SLIDE_MOVABLE_TOP = 'Slide_Movable_Top'
|
||||
WIN_SLIDE_MOVABLE_BOTTOM = 'Slide_Movable_Bottom'
|
||||
WIN_SLIDE_MOVABLE_BACK_TOP = 'Slide_MovableBack_Top'
|
||||
WIN_SLIDE_MOVABLE_BACK_BOTTOM = 'Slide_MovableBack_Bottom'
|
||||
WIN_SLIDE_MOVABLE_SIDE = 'Slide_Movable_Side'
|
||||
WIN_SLIDE_MOVABLEBACK_TOP = 'Slide_MovableBack_Top'
|
||||
WIN_SLIDE_MOVABLEBACK_BOTTOM = 'Slide_MovableBack_Bottom'
|
||||
WIN_SLIDE_MOVABLEBACK_SIDE = 'Slide_MovableBack_Side'
|
||||
WIN_SLIDE_FIXED_BOTTOM = 'Slide_Fixed_Bottom'
|
||||
WIN_SLIDE_FIXED_TOP = 'Slide_Fixed_Top'
|
||||
WIN_SLIDE_FIXED_SIDE = 'Slide_Fixed_Side'
|
||||
WIN_SLIDE_ACTIVE = 'Slide_Active'
|
||||
WIN_SLIDE_ACTIVE_IN = 'Slide_Active_In'
|
||||
WIN_SLIDE_INACTIVE = 'Slide_Inactive'
|
||||
@@ -239,7 +245,6 @@ WIN_RAILDELTA = 'RailDelta'
|
||||
-- per ferramenta
|
||||
WIN_GAPDELTA = 'GapDelta'
|
||||
WIN_GAPDELTAZ = 'GapDeltaZ'
|
||||
WIN_GAPDELTAOUT = 'GapDeltaOut'
|
||||
-- per accessori
|
||||
WIN_STRIP_DIST = 'StripDistance'
|
||||
WIN_TRIM = 'Trim'
|
||||
@@ -266,6 +271,17 @@ WIN_PRC_OFFZ_2 = 'OFFZ_2'
|
||||
WIN_PRC_CLAMPV_1 = 'CLAMPV_1'
|
||||
WIN_PRC_CLAMPV_2 = 'CLAMPV_2'
|
||||
|
||||
-- codici
|
||||
WIN_PROFILE_CODES = {
|
||||
SASH = 1,
|
||||
FIXED_GLASS = 2,
|
||||
MIXED = 4,
|
||||
FRAME_RAIL = 8,
|
||||
SASH_RAIL = 16,
|
||||
SLIDE = 32,
|
||||
}
|
||||
|
||||
|
||||
-- Profili pezzo
|
||||
WIN_PRF_MAIN = 'Main'
|
||||
WIN_PRF_START = 'Start'
|
||||
|
||||
+471
-225
@@ -515,6 +515,7 @@ local function CalcProfileType( nAreaId)
|
||||
local nSashType = EgtGetInfo( nSashArea, WIN_SASHTYPE, 'i') or WIN_SASHTYPES.NULL
|
||||
-- b1) alzante scorrevole
|
||||
if nSashType == WIN_SASHTYPES.SLIDE_MOVABLE or nSashType == WIN_SASHTYPES.SLIDE_FIXED or nSashType == WIN_SASHTYPES.SLIDE_MOVABLE_BACK then
|
||||
EgtSetInfo( nAreaId, WIN_SLIDE_WINDOW, true)
|
||||
if sName == WIN_BOTTOM then
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE .. '_' .. sThreshold)
|
||||
-- se le ante contro cui poggia sono tutte mobili devo aggiornare il profilo
|
||||
@@ -685,20 +686,26 @@ local function CalcProfileType( nAreaId)
|
||||
if nSashType == WIN_SASHTYPES.SLIDE_MOVABLE then
|
||||
if sName == WIN_BOTTOM then
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLE_BOTTOM)
|
||||
else
|
||||
elseif sName == WIN_TOP then
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLE_TOP)
|
||||
else
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLE_SIDE)
|
||||
end
|
||||
elseif nSashType == WIN_SASHTYPES.SLIDE_FIXED then
|
||||
if sName == WIN_BOTTOM then
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_FIXED_BOTTOM)
|
||||
else
|
||||
elseif sName == WIN_TOP then
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_FIXED_TOP)
|
||||
else
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_FIXED_SIDE)
|
||||
end
|
||||
elseif nSashType == WIN_SASHTYPES.SLIDE_MOVABLE_BACK then
|
||||
if sName == WIN_BOTTOM then
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLE_BACK_BOTTOM)
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLEBACK_BOTTOM)
|
||||
elseif sName == WIN_TOP then
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLEBACK_TOP)
|
||||
else
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLE_BACK_TOP)
|
||||
EgtSetInfo( nOutlineId, WIN_PROFILETYPE, WIN_SLIDE_MOVABLEBACK_SIDE)
|
||||
end
|
||||
|
||||
-- b) standard
|
||||
@@ -2138,8 +2145,8 @@ end
|
||||
----------------------------------------------------------------------------------
|
||||
---------------------------------- SOLIDO ----------------------------------------
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che costruisce una superficie estrudendo il profilo sProfileName lungo l'outline
|
||||
local function CreateProfileSurf( nOutlineId, nProfileId, sProfileName, dExtraLen, nLayerId)
|
||||
-- funzione che costruisce una superficie estrudendo il nSectionId lungo l'outline
|
||||
local function CreateProfileSurfById( nOutlineId, nProfileId, nSectionId, dExtraLen, nLayerId)
|
||||
|
||||
-- creo guida con estensione in tangenza
|
||||
local nGuideId = EgtCopy( nOutlineId, nLayerId)
|
||||
@@ -2176,8 +2183,7 @@ local function CreateProfileSurf( nOutlineId, nProfileId, sProfileName, dExtraLe
|
||||
end
|
||||
|
||||
-- recupero il profilo da estrudere
|
||||
local nOrigProfileId = EgtGetFirstNameInGroup( nProfileId, sProfileName)
|
||||
local nSectionId = EgtCopyGlob( nOrigProfileId, nLayerId)
|
||||
local nSectionRefId = EgtCopyGlob( nSectionId, nLayerId)
|
||||
|
||||
-- posiziono la sezione di estrusione sulla guida :
|
||||
-- recupero frame del profilo
|
||||
@@ -2187,17 +2193,26 @@ local function CreateProfileSurf( nOutlineId, nProfileId, sProfileName, dExtraLe
|
||||
-- calcolo il frame di destinazione sulla guida
|
||||
local frDest = Frame3d( EgtSP( nGuideId), - EgtSV( nGuideId), GDB_RT.GLOB)
|
||||
-- posiziono con i riferimenti
|
||||
EgtTransform( nSectionId, frProfile, GDB_RT.GLOB)
|
||||
EgtTransform( nSectionId, frDest, GDB_RT.GLOB)
|
||||
EgtTransform( nSectionRefId, frProfile, GDB_RT.GLOB)
|
||||
EgtTransform( nSectionRefId, frDest, GDB_RT.GLOB)
|
||||
|
||||
-- creo la superfice di estrusione
|
||||
local nStmId = EgtSurfTmSwept( nLayerId, nSectionId, nGuideId, false, WIN_SURF_APPROX)
|
||||
local nStmId = EgtSurfTmSwept( nLayerId, nSectionRefId, nGuideId, false, WIN_SURF_APPROX)
|
||||
EgtErase( nGuideId)
|
||||
EgtErase( nSectionId)
|
||||
EgtErase( nSectionRefId)
|
||||
|
||||
return nStmId
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- come CreateProfileSurfById ma riceve il nome della sezione da estrudere
|
||||
local function CreateProfileSurf( nOutlineId, nProfileId, sSectionName, dExtraLen, nLayerId)
|
||||
-- recupero l'id della sezione da estrudere
|
||||
local nSectionId = EgtGetFirstNameInGroup( nProfileId, sSectionName)
|
||||
if not nSectionId then return end
|
||||
return CreateProfileSurfById( nOutlineId, nProfileId, nSectionId, dExtraLen, nLayerId)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- funzione che crea la superficie di trim per il solido
|
||||
local function CreateTrimSurf( nGeoId, nProfileId, dGeoWidth, nLayerId)
|
||||
@@ -4275,20 +4290,74 @@ local function DrawHinges( nOutlineId, nSolidLayerId)
|
||||
EgtSetColor( nStm1, Color3d( 128, 128, 128))
|
||||
EgtSetName( nStm1, WIN_HDW_HINGES)
|
||||
EgtErase( nCompo)
|
||||
|
||||
|
||||
-- seconda cerniera
|
||||
local pt2 = EgtEP( nOutlineId) - dDelta * Z_AX() - dDimV * vtDir
|
||||
local nStm2 = EgtCopyGlob( nStm1, nSolidLayerId)
|
||||
EgtMove( nStm2, pt2 - pt1)
|
||||
|
||||
|
||||
-- correzioni per telai non rettangolari
|
||||
local nFrameAreaId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*')
|
||||
local nFrameType = EgtGetInfo( nFrameAreaId, WIN_FRAME_TYPE, 'i')
|
||||
|
||||
-- a) arco
|
||||
if nFrameType == WIN_FRAME_TYPES.ROUND_ARC or nFrameType == WIN_FRAME_TYPES.SEGMENTAL_ARC then
|
||||
local sName = EgtGetName( nOutlineId)
|
||||
-- calcolo il delta da applicare ( euristico, calcolato in base ai risultati ferramenta)
|
||||
local dDelta = 24 -- caso di arco a tutto sesto
|
||||
local dDeltaSegArc = 54.7 -- caso di arco ribassato
|
||||
if nFrameType == WIN_FRAME_TYPES.SEGMENTAL_ARC then
|
||||
-- nel caso di arco ribassato il delta va calcolato rispetto al frame della ferramenta
|
||||
local nAreaId = EgtGetParent( EgtGetParent( nOutlineId))
|
||||
local nHdwFramesId = EgtGetFirstNameInGroup( nAreaId, WIN_HDW_FRAME)
|
||||
local sFrameName = EgtIf( sName == WIN_LEFT, 'B*', 'C*')
|
||||
local nFrameId = EgtGetFirstNameInGroup( nHdwFramesId, sFrameName)
|
||||
if sName == WIN_LEFT then
|
||||
dDelta = ( EgtSP( nFrameId) - EgtSP( nOutlineId)) * vtDir
|
||||
else
|
||||
dDelta = ( EgtEP( nOutlineId) - EgtSP( nFrameId)) * vtDir
|
||||
end
|
||||
dDelta = dDelta + dDeltaSegArc
|
||||
end
|
||||
|
||||
-- traslazione
|
||||
if sName == WIN_LEFT then
|
||||
EgtMove( nStm1, dDelta * vtDir)
|
||||
else
|
||||
EgtMove( nStm2, - dDelta * vtDir)
|
||||
end
|
||||
|
||||
-- b) trapezio
|
||||
elseif nFrameType == WIN_FRAME_TYPES.CHAMFER_SIDE then
|
||||
-- calcolo il delta da applicare. Euristico. Dal calcolo della ferramenta si vede che la cerniera si trova circa nel punto di intersezione tra nOutlineId e una retta inclinata
|
||||
-- come il top e passante per il frame della ferramenta
|
||||
local sName = EgtGetName( nOutlineId)
|
||||
local nOutlineLayId = EgtGetParent( nOutlineId)
|
||||
local nAreaId = EgtGetParent( nOutlineLayId)
|
||||
local nHdwFramesId = EgtGetFirstNameInGroup( nAreaId, WIN_HDW_FRAME)
|
||||
local sFrameName = EgtIf( sName == WIN_LEFT, 'B*', 'C*')
|
||||
local nFrameId = EgtGetFirstNameInGroup( nHdwFramesId , sFrameName)
|
||||
local nTopId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_TOP)
|
||||
local vtTop = EgtSV( nTopId)
|
||||
local ptRef = EgtIf( sName == WIN_LEFT, EgtSP( nOutlineId), EgtEP( nOutlineId))
|
||||
local vtDist = EgtSP( nFrameId) - ptRef
|
||||
local dDelta = ( vtDist ^ vtTop):len() / ( vtTop ^ vtDir):len()
|
||||
|
||||
if sName == WIN_LEFT then
|
||||
EgtMove( nStm1, dDelta * vtDir)
|
||||
else
|
||||
EgtMove( nStm2, - dDelta * vtDir)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- funzione che disegna la maniglia
|
||||
local function DrawHandle( nOutlineId, sHandleSide, dHandleH, nSolidLayerId)
|
||||
local function DrawHandle( nOutlineId, sHandleSide, dHandleH, nSolidLayerId, bSlide)
|
||||
|
||||
-- dati della maniglia
|
||||
local dBase1 = 40
|
||||
local dBase1T = 40
|
||||
local dBase1B = 40
|
||||
local dBase2 = 18
|
||||
local dH = 9
|
||||
local dLen1 = 53
|
||||
@@ -4296,6 +4365,14 @@ local function DrawHandle( nOutlineId, sHandleSide, dHandleH, nSolidLayerId)
|
||||
local dRadH = 12.5
|
||||
local dFillet = 10
|
||||
local dExtraGapDelta = 15
|
||||
if bSlide then
|
||||
dBase1T = 50
|
||||
dBase1B = 100
|
||||
dBase2 = 18
|
||||
dLen2 = 155
|
||||
dRadH = 10
|
||||
dExtraGapDelta = 35.5
|
||||
end
|
||||
|
||||
local nPartId = EgtGetInfo( nOutlineId, WIN_REF_PART, 'i')
|
||||
local ptRef = EgtIf( sHandleSide == 'Sx', EgtSP( nOutlineId), EgtEP( nOutlineId))
|
||||
@@ -4315,11 +4392,11 @@ local function DrawHandle( nOutlineId, sHandleSide, dHandleH, nSolidLayerId)
|
||||
-- punto su cui centrare la maniglia
|
||||
local ptC = ptRef + ( dHandleH + dGapHardware) * vtDir + dDeltaIn * vtDirIn
|
||||
|
||||
local nCrv1 = EgtRectangle2P( nSolidLayerId, ptC - dBase1 * vtDir - dBase2 * vtDirIn, ptC + dBase1 * vtDir + dBase2 * vtDirIn)
|
||||
local nCrv1 = EgtRectangle2P( nSolidLayerId, ptC - dBase1B * vtDir - dBase2 * vtDirIn, ptC + dBase1T * vtDir + dBase2 * vtDirIn)
|
||||
local nStm1 = EgtSurfTmByRegionExtrusion( nSolidLayerId, {nCrv1}, dH * Z_AX())
|
||||
|
||||
local nCrv2 = EgtLinePVL( nSolidLayerId, ORIG(), X_AX(), dLen1 - dFillet)
|
||||
local nCrv4 = EgtLinePVL( nSolidLayerId, Point3d( dLen1, -dFillet, 0), - Y_AX(), dLen2)
|
||||
local nCrv4 = EgtLinePVL( nSolidLayerId, Point3d( dLen1, -dFillet, 0), - Y_AX(), dLen2 - dFillet)
|
||||
local nCrv3 = EgtArc2PR( nSolidLayerId, EgtEP( nCrv2), EgtSP( nCrv4), dFillet, false)
|
||||
local nGuide = EgtCurveCompo( nSolidLayerId, { nCrv2, nCrv3, nCrv4})
|
||||
local frTransf = Frame3d( ptC, Z_AX(), vtDir, Z_AX() ^ vtDir)
|
||||
@@ -4343,6 +4420,7 @@ local function DrawSashHardware( nAreaId, nRefAreaId, nSolidLayerId)
|
||||
if nOpeningType == WIN_OPENING_TYPES.NULL or nOpeningType == WIN_OPENING_TYPES.FIXED then
|
||||
return
|
||||
|
||||
-- Vasistas
|
||||
elseif nOpeningType == WIN_OPENING_TYPES.TILTONLY_TOP then
|
||||
-- cerniere sul pezzo inferiore
|
||||
local nBottomId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_BOTTOM)
|
||||
@@ -4373,7 +4451,29 @@ local function DrawSashHardware( nAreaId, nRefAreaId, nSolidLayerId)
|
||||
|
||||
-- disegno maniglia
|
||||
DrawHandle( nOutlineId, sHandleSide, dHandleH, nSolidLayerId)
|
||||
|
||||
-- Alzante scorrevole
|
||||
elseif nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_LEFT or nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_RIGHT or
|
||||
nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_LEFT or nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_RIGHT then
|
||||
|
||||
local bLeftSlide = ( nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_LEFT or nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_LEFT)
|
||||
local nOutlineId = EgtGetFirstNameInGroup( nOutlineLayId, EgtIf( bLeftSlide, WIN_RIGHT, WIN_LEFT))
|
||||
local sHandleSide = EgtIf( bLeftSlide, 'Sx', 'Dx')
|
||||
|
||||
-- recupero altezza maniglia dalle opzioni
|
||||
local dHandleH = 400
|
||||
local vOptions = EgtGetInfo( nRefAreaId, WIN_HDW_OPTIONS, 'vs') or {}
|
||||
for i = 1, #vOptions do
|
||||
local vString = EgtSplitString( vOptions[i], '=')
|
||||
if #vString == 2 and vString[1] == WIN_HDW_HANDLE_HEIGHT then
|
||||
dHandleH = tonumber( vString[2])
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
DrawHandle( nOutlineId, sHandleSide, dHandleH, nSolidLayerId, true)
|
||||
|
||||
-- Standard
|
||||
else
|
||||
local nSashType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') or WIN_SASHTYPES.NULL
|
||||
|
||||
@@ -4426,149 +4526,147 @@ local function SearchSash( nAreaId, SashList)
|
||||
-- verifico il tipo
|
||||
local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i')
|
||||
if nAreaType == WIN_AREATYPES.SASH then
|
||||
-- calcolo il Box
|
||||
local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE)
|
||||
local b3Outline = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD)
|
||||
-- recupero punti di origine
|
||||
local nSashFrameLayerId = EgtGroup( nAreaId)
|
||||
EgtSetName( nSashFrameLayerId, WIN_HDW_FRAME)
|
||||
EgtSetStatus( nSashFrameLayerId, GDB_ST.OFF)
|
||||
local vOutlineCopy = {}
|
||||
|
||||
-- creo gruppo temporaneo per i conti
|
||||
local nOutlineOffsetLayerId = EgtGroup( nAreaId)
|
||||
|
||||
-- recupero gruppi dei profili
|
||||
local nProfileId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE)
|
||||
local nSashProfileLayerId = EgtGetFirstNameInGroup( nProfileId, WIN_SASH)
|
||||
local nFrameProfileLayerId = EgtGetFirstNameInGroup( nProfileId, WIN_FRAME)
|
||||
|
||||
-- creo gruppo per i riferimenti della ferramenta per l'anta
|
||||
local nHdwSashLayerId = EgtGroup( nAreaId)
|
||||
EgtSetName( nHdwSashLayerId, WIN_HDW_FRAME)
|
||||
EgtSetStatus( nHdwSashLayerId, GDB_ST.OFF)
|
||||
|
||||
-- recupero o creo gruppo per i riferimenti della ferramenta per il telaio
|
||||
local nFrameAreaId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*')
|
||||
local nHdwFrameLayerId = EgtGetFirstNameInGroup( nFrameAreaId, WIN_HDW_FRAME)
|
||||
if not nHdwFrameLayerId then
|
||||
nHdwFrameLayerId = EgtGroup( nFrameAreaId)
|
||||
EgtSetName( nHdwFrameLayerId, WIN_HDW_FRAME)
|
||||
EgtSetStatus( nHdwFrameLayerId, GDB_ST.OFF)
|
||||
end
|
||||
|
||||
-- verifico se alzante scorrevole
|
||||
local bSlide = EgtGetInfo( nFrameAreaId, WIN_SLIDE_WINDOW, 'b') or false
|
||||
|
||||
-- ricostruisco gli outlines dell'anta in corrispondenza del canalino della ferramenta ( orgine dei riferimenti)
|
||||
local vOutlineCopy = {}
|
||||
local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE)
|
||||
local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId)
|
||||
while nOutlineId do
|
||||
local sProfileType = EgtGetInfo( nOutlineId, WIN_PROFILETYPE)
|
||||
local nProfileId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE, 'i')
|
||||
local nSashProfileId = EgtGetFirstNameInGroup( nProfileId, WIN_SASH, 'i')
|
||||
local nSashProfileTypeId = EgtGetFirstNameInGroup( nSashProfileId, sProfileType, 'i')
|
||||
local dGapDelta = EgtGetInfo( nSashProfileTypeId, WIN_GAPDELTA, 'd')
|
||||
local dGapDeltaZ = EgtGetInfo( nSashProfileTypeId, WIN_GAPDELTAZ, 'd')
|
||||
local sProfileType = EgtGetInfo( nOutlineId, WIN_PROFILETYPE)
|
||||
local nSashProfileId = EgtGetFirstNameInGroup( nSashProfileLayerId, sProfileType)
|
||||
local dGapDelta = EgtGetInfo( nSashProfileId, WIN_GAPDELTA, 'd')
|
||||
local nOutlineCopyId = EgtCopy( nOutlineId, nOutlineOffsetLayerId)
|
||||
EgtSetInfo( nOutlineCopyId, 'ORIG', nOutlineId)
|
||||
EgtSetInfo( nOutlineCopyId, WIN_GAPDELTAZ, dGapDeltaZ)
|
||||
local nSectionFrameId = EgtGetFirstNameInGroup( nSashProfileTypeId, WIN_SECTIONFRAME)
|
||||
local frSectionFrame = EgtFR( nSectionFrameId)
|
||||
local nSashProfileRefId = EgtGetFirstNameInGroup( nSashProfileTypeId, WIN_REF)
|
||||
local b3SashProfileType = EgtGetBBoxRef( nSashProfileRefId, GDB_BB.STANDARD, frSectionFrame)
|
||||
EgtSetInfo( nOutlineCopyId, WIN_GAPDELTAZ .. 2, b3SashProfileType:getDimY())
|
||||
EgtOffsetCurve( nOutlineCopyId, - dGapDelta)
|
||||
table.insert( vOutlineCopy, nOutlineCopyId)
|
||||
-- setto info ausiliarie sulla curva
|
||||
EgtSetInfo( nOutlineCopyId, 'ORIG', nOutlineId)
|
||||
CopyInfo( nOutlineCopyId, nSashProfileId, WIN_GAPDELTAZ)
|
||||
local b3Profile = GetProfileLocalBox( nSashProfileId)
|
||||
EgtSetInfo( nOutlineCopyId, WIN_GAPDELTAZ .. 2, b3Profile:getDimY())
|
||||
nOutlineId = EgtGetNext( nOutlineId)
|
||||
end
|
||||
local tSash = { nAreaId = nAreaId, ptCenter = b3Outline:getCenter()}
|
||||
TrimAndOrientOrderedCurves( vOutlineCopy, false)
|
||||
|
||||
-- costruisco i riferimenti
|
||||
local tFrame = {}
|
||||
local nA_FA1Id = GDB_ID.NULL
|
||||
local nB_FA1Id = GDB_ID.NULL
|
||||
local nC_FA1Id = GDB_ID.NULL
|
||||
local nD_FA1Id = GDB_ID.NULL
|
||||
for nIndex = 1, #vOutlineCopy do
|
||||
local nNext = EgtIf( nIndex < #vOutlineCopy, nIndex + 1, 1)
|
||||
local ptOrig = EgtIP( vOutlineCopy[nIndex], vOutlineCopy[nNext], ORIG())
|
||||
local dParam = EgtCurveParamAtPoint( vOutlineCopy[nIndex], ptOrig)
|
||||
EgtTrimCurveEndAtParam( vOutlineCopy[nIndex], dParam)
|
||||
dParam = EgtCurveParamAtPoint( vOutlineCopy[nNext], ptOrig)
|
||||
EgtTrimCurveStartAtParam( vOutlineCopy[nNext], dParam)
|
||||
local sOrigName = string.char(string.byte('A') + #vOutlineCopy - nIndex)
|
||||
tSash[sOrigName] = ptOrig
|
||||
-- 1) Riferimenti ANTA
|
||||
local ptOrig = EgtEP( vOutlineCopy[nIndex])
|
||||
local sOrigName = string.char( string.byte( 'A') + #vOutlineCopy - nIndex)
|
||||
local vtDir = EgtEV( vOutlineCopy[nIndex])
|
||||
local nFA1Id = EgtFrame( nSashFrameLayerId, Frame3d( ptOrig, - vtDir, vtDir ^ Z_AX() , Z_AX()))
|
||||
local nFA1Id = EgtFrame( nHdwSashLayerId, Frame3d( ptOrig, - vtDir, vtDir ^ Z_AX(), Z_AX()))
|
||||
EgtSetName( nFA1Id, sOrigName .. '.FA1')
|
||||
local vtIn = Vector3d( vtDir)
|
||||
vtIn:rotate( Z_AX(), -90)
|
||||
local dGapDeltaZ = EgtGetInfo( vOutlineCopy[nIndex], WIN_GAPDELTAZ, 'd')
|
||||
local nFA2Id = EgtFrame( nSashFrameLayerId, Frame3d( ptOrig - dGapDeltaZ * Z_AX(), - vtDir, vtDir ^ vtIn , vtIn))
|
||||
local nFA2Id = EgtFrame( nHdwSashLayerId, Frame3d( ptOrig - dGapDeltaZ * Z_AX(), - vtDir, vtDir ^ vtIn, vtIn))
|
||||
EgtSetName( nFA2Id, sOrigName .. '.FA2')
|
||||
local dGapDeltaZ2 = EgtGetInfo( vOutlineCopy[nIndex], WIN_GAPDELTAZ .. 2, 'd')
|
||||
local nFA3Id = EgtFrame( nSashFrameLayerId, Frame3d( ptOrig - dGapDeltaZ2 * Z_AX(), - vtDir, vtDir ^ -Z_AX() , -Z_AX()))
|
||||
local nFA3Id = EgtFrame( nHdwSashLayerId, Frame3d( ptOrig - dGapDeltaZ2 * Z_AX(), - vtDir, vtDir ^ -Z_AX(), -Z_AX()))
|
||||
EgtSetName( nFA3Id, sOrigName .. '.FA3')
|
||||
if sOrigName == 'A' then
|
||||
nA_FA1Id = nFA1Id
|
||||
elseif sOrigName == 'B' then
|
||||
nB_FA1Id = nFA1Id
|
||||
elseif sOrigName == 'C' then
|
||||
nC_FA1Id = nFA1Id
|
||||
elseif sOrigName == 'D' then
|
||||
nD_FA1Id = nFA1Id
|
||||
end
|
||||
-- ricavo posizione sul telaio
|
||||
|
||||
-- 2) Riferimenti TELAIO
|
||||
-- ricavo elemento su cui poggia ( è il primo parent con un profilo associato. Potrebbe essere uno split in sottoarea del telaio o potrebbe non
|
||||
-- esistere nel caso di french split)
|
||||
local nOrigOutlineId = EgtGetInfo( vOutlineCopy[nIndex], 'ORIG', 'i')
|
||||
local nBaseOutlineId = EgtGetInfo( nOrigOutlineId, WIN_COPY, 'i')
|
||||
local nSouId = EgtGetInfo( nBaseOutlineId, WIN_SOU, 'i')
|
||||
local nSouAreaId = EgtGetParent( EgtGetParent( nSouId))
|
||||
local nSouAreaType = EgtGetInfo( nSouAreaId, WIN_AREATYPE, 'i')
|
||||
while nSouId and nSouAreaType ~= WIN_AREATYPES.FRAME do
|
||||
local sProfileFrame = EgtGetInfo( nSouId, WIN_PROFILETYPE)
|
||||
while nSouId and not sProfileFrame do
|
||||
nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i')
|
||||
nSouAreaId = EgtGetParent( EgtGetParent( nSouId or GDB_ID.NULL))
|
||||
nSouAreaType = EgtGetInfo( nSouAreaId or GDB_ID.NULL, WIN_AREATYPE, 'i')
|
||||
sProfileFrame = EgtGetInfo( nSouId or GDB_ID.NULL, WIN_PROFILETYPE)
|
||||
end
|
||||
|
||||
if nSouId then
|
||||
local nFrameFrameLayerId = EgtGetFirstNameInGroup( nSouAreaId, WIN_HDW_FRAME)
|
||||
if not nFrameFrameLayerId then
|
||||
nFrameFrameLayerId = EgtGroup( nSouAreaId)
|
||||
EgtSetName( nFrameFrameLayerId, WIN_HDW_FRAME)
|
||||
EgtSetStatus( nFrameFrameLayerId, GDB_ST.OFF)
|
||||
end
|
||||
-- ricavo aria lato telaio
|
||||
local sProfileType = EgtGetInfo( nSouId, WIN_PROFILETYPE)
|
||||
if sProfileType then -- controllo non sia french split
|
||||
local nProfileId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE, 'i')
|
||||
local nFrameProfileId = EgtGetFirstNameInGroup( nProfileId, WIN_FRAME, 'i')
|
||||
local nFrameProfileTypeId = EgtGetFirstNameInGroup( nFrameProfileId, sProfileType, 'i')
|
||||
local dFrameGapDeltaZ = EgtGetInfo( nFrameProfileTypeId, WIN_GAPDELTAZ, 'd')
|
||||
local dGapDeltaOut = EgtGetInfo( nFrameProfileTypeId, WIN_GAPDELTAOUT, 'd')
|
||||
-- se deriva da split verifico il lato
|
||||
if EgtGetName( nSouId) == WIN_SPLIT then
|
||||
local bSameDir = AreSameVectorApprox( EgtSV( nSouId), EgtSV( nBaseOutlineId))
|
||||
if not dGapDeltaOut then
|
||||
-- recupero informazione dal lato corretto ( split orizzontale)
|
||||
if bSameDir then
|
||||
dGapDeltaOut = EgtGetInfo( nFrameProfileTypeId, WIN_GAPDELTAOUT .. '2', 'd')
|
||||
else
|
||||
dGapDeltaOut = EgtGetInfo( nFrameProfileTypeId, WIN_GAPDELTAOUT .. '1', 'd')
|
||||
end
|
||||
end
|
||||
-- verifico il segno dell'offset
|
||||
if not bSameDir then
|
||||
dGapDeltaOut = - dGapDeltaOut
|
||||
local nFrameProfileId = EgtGetFirstNameInGroup( nFrameProfileLayerId, sProfileFrame, 'i')
|
||||
local dGapDeltaOut = EgtGetInfo( nFrameProfileId, WIN_GAPDELTA, 'd')
|
||||
-- se deriva da split verifico il lato
|
||||
if EgtGetName( nSouId) == WIN_SPLIT then
|
||||
local bSameDir = AreSameVectorApprox( EgtSV( nSouId), EgtSV( nBaseOutlineId))
|
||||
-- recupero informazione dal lato corretto ( split orizzontale)
|
||||
if not dGapDeltaOut then
|
||||
if bSameDir then
|
||||
dGapDeltaOut = EgtGetInfo( nFrameProfileId, WIN_GAPDELTA .. '2', 'd')
|
||||
else
|
||||
dGapDeltaOut = EgtGetInfo( nFrameProfileId, WIN_GAPDELTA .. '1', 'd')
|
||||
end
|
||||
end
|
||||
local nOutlineOutId = EgtCopy( nSouId, nOutlineOffsetLayerId)
|
||||
EgtSetName( nOutlineOutId, 'Frame')
|
||||
EgtOffsetCurve( nOutlineOutId, - dGapDeltaOut)
|
||||
-- prendo la proiezione
|
||||
_, ptOrig = EgtPointCurveDist( ptOrig, nOutlineOutId)
|
||||
-- recupero DeltaZ2
|
||||
local nSectionFrameId = EgtGetFirstNameInGroup( nFrameProfileTypeId, WIN_SECTIONFRAME)
|
||||
local frSectionFrame = EgtFR( nSectionFrameId)
|
||||
local nFrameProfileRefId = EgtGetFirstNameInGroup( nFrameProfileTypeId, WIN_REF)
|
||||
local b3SashProfileType = EgtGetBBoxRef( nFrameProfileRefId, GDB_BB.STANDARD, frSectionFrame)
|
||||
local nFT1Id = EgtFrame( nFrameFrameLayerId, Frame3d( ptOrig - dFrameGapDeltaZ * Z_AX(), - vtDir, vtDir ^ Z_AX() , Z_AX()))
|
||||
EgtSetName( nFT1Id, sOrigName .. '.FT1')
|
||||
table.insert( tFrame, nFT1Id)
|
||||
local vtFrameIn = Vector3d( vtDir)
|
||||
vtFrameIn:rotate( Z_AX(), 90)
|
||||
local nFT2Id = EgtFrame( nFrameFrameLayerId, Frame3d( ptOrig - dFrameGapDeltaZ * Z_AX(), - vtDir, vtDir ^ vtFrameIn , vtFrameIn))
|
||||
EgtSetName( nFT2Id, sOrigName .. '.FT2')
|
||||
table.insert( tFrame, nFT2Id)
|
||||
local dGapDeltaZ2 = b3SashProfileType:getDimY()
|
||||
local nFT3Id = EgtFrame( nFrameFrameLayerId, Frame3d( ptOrig - dGapDeltaZ2 * Z_AX(), - vtDir, vtDir ^ -Z_AX() , -Z_AX()))
|
||||
EgtSetName( nFT3Id, sOrigName .. '.FT3')
|
||||
table.insert( tFrame, nFT3Id)
|
||||
-- verifico il segno dell'offset
|
||||
if not bSameDir then
|
||||
dGapDeltaOut = - dGapDeltaOut
|
||||
end
|
||||
end
|
||||
local nOutlineOutId = EgtCopy( nSouId, nOutlineOffsetLayerId)
|
||||
EgtOffsetCurve( nOutlineOutId, - dGapDeltaOut)
|
||||
-- recupero origine come proiezione sul telaio dell'origine dell'anta
|
||||
local _, ptOrigFr = EgtPointCurveDist( ptOrig, nOutlineOutId)
|
||||
if bSlide then
|
||||
-- nel caso di alzante scorrevole l'origine non è proiettata
|
||||
ptOrigFr = EgtEP( nOutlineOutId)
|
||||
end
|
||||
local nFT1Id = EgtFrame( nHdwFrameLayerId, Frame3d( ptOrigFr, - vtDir, vtDir ^ Z_AX(), Z_AX()))
|
||||
EgtSetName( nFT1Id, sOrigName .. '.FT1')
|
||||
table.insert( tFrame, nFT1Id)
|
||||
local vtFrameIn = Vector3d( vtDir)
|
||||
vtFrameIn:rotate( Z_AX(), 90)
|
||||
local dFrameGapDeltaZ = EgtGetInfo( nFrameProfileId, WIN_GAPDELTAZ, 'd')
|
||||
local nFT2Id = EgtFrame( nHdwFrameLayerId, Frame3d( ptOrigFr - dFrameGapDeltaZ * Z_AX(), - vtDir, vtDir ^ vtFrameIn, vtFrameIn))
|
||||
EgtSetName( nFT2Id, sOrigName .. '.FT2')
|
||||
table.insert( tFrame, nFT2Id)
|
||||
local b3FrameProfile = GetProfileLocalBox( nFrameProfileId)
|
||||
local dGapDeltaZ2 = b3FrameProfile:getDimY()
|
||||
local nFT3Id = EgtFrame( nHdwFrameLayerId, Frame3d( ptOrigFr - dGapDeltaZ2 * Z_AX(), - vtDir, vtDir ^ -Z_AX(), -Z_AX()))
|
||||
EgtSetName( nFT3Id, sOrigName .. '.FT3')
|
||||
table.insert( tFrame, nFT3Id)
|
||||
end
|
||||
end
|
||||
tSash.Frame = tFrame
|
||||
tSash.LHeight = ( EgtSP( nB_FA1Id) - EgtSP( nA_FA1Id)):getY()
|
||||
tSash.RHeight = ( EgtSP( nC_FA1Id) - EgtSP( nD_FA1Id)):getY()
|
||||
tSash.TWidth = ( EgtSP( nC_FA1Id) - EgtSP( nB_FA1Id)):getX()
|
||||
tSash.BWidth = ( EgtSP( nD_FA1Id) - EgtSP( nA_FA1Id)):getX()
|
||||
|
||||
-- preparo tabella per l'anta con i dati necessari per la ferramenta
|
||||
local tSash = { nAreaId = nAreaId}
|
||||
-- calcolo in centro per ordinamento
|
||||
local b3Outline = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD)
|
||||
tSash.ptCenter = b3Outline:getCenter()
|
||||
-- calcolo le dimensioni
|
||||
tSash.LHeight = EgtCurveLength( vOutlineCopy[4])
|
||||
tSash.RHeight = EgtCurveLength( vOutlineCopy[2])
|
||||
tSash.BWidth = EgtCurveLength( vOutlineCopy[1])
|
||||
if EgtGetType( vOutlineCopy[3]) == GDB_TY.CRV_ARC then
|
||||
tSash.BCLength = EgtCurveLength( vOutlineCopy[3])
|
||||
tSash.BCArrow = EgtMP( vOutlineCopy[3]) - (( EgtEP( vOutlineCopy[3]) - EgtSP( vOutlineCopy[3])) / 2)
|
||||
-- tSash.BCLength = EgtCurveLength( vOutlineCopy[3]) -- in alternativa a BCArrow, è il parametro LBBA nel file di richiesta
|
||||
tSash.BCArrow = dist( EgtMP( vOutlineCopy[3]), 0.5 * ( EgtEP( vOutlineCopy[3]) + EgtSP( vOutlineCopy[3])))
|
||||
end
|
||||
EgtErase( nOutlineOffsetLayerId)
|
||||
-- salvo i frame del telaio associati
|
||||
tSash.Frame = tFrame
|
||||
table.insert( SashList, tSash)
|
||||
|
||||
EgtErase( nOutlineOffsetLayerId)
|
||||
end
|
||||
|
||||
-- verifico se ci sono sotto-aree
|
||||
local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*')
|
||||
while nChildAreaId do
|
||||
@@ -4584,6 +4682,7 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest)
|
||||
-- cerco ed indicizzo ante del serramento
|
||||
local SashList = {}
|
||||
SearchSash( nFrameId, SashList)
|
||||
|
||||
-- ordino per X e Y
|
||||
local function compareXY(a,b)
|
||||
if abs( a.ptCenter:getX() - b.ptCenter:getX()) < GEO.EPS_SMALL then
|
||||
@@ -4592,9 +4691,9 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest)
|
||||
return a.ptCenter:getX() < b.ptCenter:getX()
|
||||
end
|
||||
end
|
||||
table.sort(SashList, compareXY)
|
||||
table.sort( SashList, compareXY)
|
||||
|
||||
-- correggo nomi Frame del telaio
|
||||
-- correggo nomi Frame del telaio in base all'ordinamento delle ante
|
||||
for nIndex = 1, #SashList do
|
||||
for nFrameIndex = 1, #SashList[nIndex].Frame do
|
||||
local nFrameId = SashList[nIndex].Frame[nFrameIndex]
|
||||
@@ -4643,44 +4742,56 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest)
|
||||
if #SashList > 0 then
|
||||
nOpeningType = EgtGetInfo( SashList[1].nAreaId, WIN_OPENING_TYPE, 'i')
|
||||
end
|
||||
-- recupero se scorrevole
|
||||
local bSlide = EgtGetInfo( nFrameId, WIN_SLIDE_WINDOW, 'b') or false
|
||||
|
||||
if bSlide then
|
||||
-- le dimensioni per alzante scorrevole sono quelle del telaio
|
||||
local nOutlineLayId = EgtGetFirstInGroup( nFrameId, WIN_AREAOUTLINE)
|
||||
local nBottomId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_BOTTOM)
|
||||
local dMet = EgtCurveLength( nBottomId)
|
||||
local nLeftId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_LEFT)
|
||||
local dHet = EgtCurveLength( nLeftId)
|
||||
sText = sText .. 'MET=' .. tostring( dMet) .. '\n'
|
||||
sText = sText .. 'HET=' .. tostring( dHet) .. '\n'
|
||||
|
||||
if #SashList >= 1 and abs( SashList[1].LHeight - SashList[1].RHeight) < GEO.EPS_SMALL then
|
||||
sText = sText .. 'HBB=' .. tostring( SashList[1].LHeight) .. '\n'
|
||||
else
|
||||
for nSashIndex = 1, #SashList do
|
||||
if nSashIndex == 1 then
|
||||
sText = sText .. 'HBB_sx=' .. tostring( SashList[nSashIndex].LHeight) .. '\n'
|
||||
else
|
||||
sText = sText .. 'HBB_' .. tostring(nSashIndex - 1) .. 'B=' .. tostring( SashList[nSashIndex].LHeight) .. '\n'
|
||||
if #SashList >= 1 and abs( SashList[1].LHeight - SashList[1].RHeight) < GEO.EPS_SMALL then
|
||||
sText = sText .. 'HBB=' .. tostring( SashList[1].LHeight) .. '\n'
|
||||
else
|
||||
for nSashIndex = 1, #SashList do
|
||||
if nSashIndex == 1 then
|
||||
sText = sText .. 'HBB_sx=' .. tostring( SashList[nSashIndex].LHeight) .. '\n'
|
||||
else
|
||||
sText = sText .. 'HBB_' .. tostring( nSashIndex - 1) .. 'B=' .. tostring( SashList[nSashIndex].LHeight) .. '\n'
|
||||
end
|
||||
if nSashIndex == #SashList then
|
||||
sText = sText .. 'HBB_dx=' .. tostring( SashList[nSashIndex].RHeight) .. '\n'
|
||||
else
|
||||
sText = sText .. 'HBB_' .. tostring( nSashIndex) .. '=' .. tostring( SashList[nSashIndex].RHeight) .. '\n'
|
||||
end
|
||||
end
|
||||
if nSashIndex == #SashList then
|
||||
sText = sText .. 'HBB_dx=' .. tostring( SashList[nSashIndex].RHeight) .. '\n'
|
||||
else
|
||||
sText = sText .. 'HBB_' .. tostring(nSashIndex) .. '=' .. tostring( SashList[nSashIndex].RHeight) .. '\n'
|
||||
end
|
||||
|
||||
if #SashList == 1 then
|
||||
sText = sText .. 'LBB=' .. tostring( SashList[1].BWidth) .. '\n'
|
||||
if SashList[1].BCArrow then
|
||||
sText = sText .. 'FRECCIA_1=' .. tostring( SashList[1].BCArrow) .. '\n'
|
||||
end
|
||||
else
|
||||
for nSashIndex = 1, #SashList do
|
||||
sText = sText .. 'LBB' .. nSashIndex .. '=' .. tostring( SashList[nSashIndex].BWidth) .. '\n'
|
||||
if SashList[nSashIndex].BCArrow then
|
||||
sText = sText .. 'FRECCIA_' .. nSashIndex .. '=' .. tostring( SashList[nSashIndex].BCArrow) .. '\n'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #SashList == 1 then
|
||||
sText = sText .. 'LBB=' .. tostring( SashList[1].BWidth) .. '\n'
|
||||
else
|
||||
for nSashIndex = 1, #SashList do
|
||||
sText = sText .. 'LBB' .. nSashIndex .. '=' .. tostring( SashList[nSashIndex].BWidth) .. '\n'
|
||||
if SashList[nSashIndex].BCLength then
|
||||
sText = sText .. 'LBBA' .. nSashIndex .. '=' .. tostring( SashList[nSashIndex].BCLength) .. '\n'
|
||||
end
|
||||
if SashList[nSashIndex].BCArrow then
|
||||
sText = sText .. 'FRECCIA_' .. nSashIndex .. '=' .. tostring( SashList[nSashIndex].BCArrow) .. '\n'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
sText = sText .. 'FINESTRAPORTAFINESTRA=Finestra' .. '\n' ..
|
||||
'Q=1' .. '\n'
|
||||
|
||||
-- opzione manoserramento ( non per vasistas)
|
||||
-- opzione manoserramento ( non per vasistas altrimenti sovrascrive l'opzione)
|
||||
if nOpeningType ~= WIN_OPENING_TYPES.TILTONLY_TOP then
|
||||
sText = sText .. 'MANOSERRAMENTO=' .. sHandle .. '\n'
|
||||
end
|
||||
@@ -4718,6 +4829,8 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest)
|
||||
EgtOutLog( 'Error opening file ' .. sOutputLavFile)
|
||||
return false
|
||||
end
|
||||
local nFrameAreaId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*')
|
||||
local nHdwFrameLayerId = EgtGetFirstNameInGroup( nFrameAreaId, WIN_HDW_FRAME)
|
||||
local sOutputLine = fhOutput:lines('l')
|
||||
for sMach in fhOutput:lines('l') do
|
||||
local MachParams = EgtSplitString( sMach, ';')
|
||||
@@ -4734,34 +4847,31 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest)
|
||||
local nSashId = SashList[nSashIndex].nAreaId
|
||||
local nOutlineLayerId = EgtGetFirstNameInGroup( nSashId, WIN_OUTLINE)
|
||||
local vOutlineIds = EgtGetAllInGroup( nOutlineLayerId)
|
||||
local nA = string.byte('A')
|
||||
local nSashPart = string.byte(sSashPart)
|
||||
local nOutlineIndex = #vOutlineIds - (nSashPart - nA)
|
||||
local nA = string.byte( 'A')
|
||||
local nSashPart = string.byte( sSashPart)
|
||||
local nOutlineIndex = #vOutlineIds - ( nSashPart - nA)
|
||||
local nOutlineId = vOutlineIds[nOutlineIndex]
|
||||
local nPartId = GDB_ID.NULL
|
||||
local frHdwFrame
|
||||
local frHdw
|
||||
if sPart == 'TELAIO' then
|
||||
local nSashBaseOutlineId = EgtGetInfo( nOutlineId, WIN_COPY, 'i')
|
||||
local nSouId = EgtGetInfo( nSashBaseOutlineId, WIN_SOU, 'i')
|
||||
local nSouAreaId = EgtGetParent( EgtGetParent( nSouId))
|
||||
local nSouAreaType = EgtGetInfo( nSouAreaId, WIN_AREATYPE, 'i')
|
||||
while nSouAreaType ~= WIN_AREATYPES.FRAME do
|
||||
local sSouProfile = EgtGetInfo( nSouId, WIN_PROFILETYPE)
|
||||
while nSouId and not sSouProfile do
|
||||
nSouId = EgtGetInfo( nSouId, WIN_SOU, 'i')
|
||||
nSouAreaId = EgtGetParent( EgtGetParent( nSouId))
|
||||
nSouAreaType = EgtGetInfo( nSouAreaId, WIN_AREATYPE, 'i')
|
||||
sSouProfile = EgtGetInfo( nSouId or GDB_ID.NULL, WIN_PROFILETYPE)
|
||||
end
|
||||
local nFrameOutlineId = EgtGetInfo( nSouId, WIN_COPY, 'i')
|
||||
nPartId = EgtGetInfo( nFrameOutlineId, WIN_REF_PART, 'i')
|
||||
local nHdwFrameLayerId = EgtGetFirstNameInGroup( nSouAreaId, WIN_HDW_FRAME)
|
||||
local nHdwFrameId = EgtGetLastNameInGroup( nHdwFrameLayerId, nSashIndex .. '.' .. sSashPart .. '.' .. sSide)
|
||||
frHdwFrame = EgtFR( nHdwFrameId)
|
||||
frHdw = EgtFR( nHdwFrameId)
|
||||
elseif sPart == 'ANTA' then
|
||||
nPartId = EgtGetInfo( nOutlineId, WIN_REF_PART, 'i')
|
||||
local nHdwFrameLayerId = EgtGetFirstNameInGroup( nSashId, WIN_HDW_FRAME)
|
||||
local nHdwFrameId = EgtGetLastNameInGroup( nHdwFrameLayerId, sSashPart .. '.' .. sSide)
|
||||
frHdwFrame = EgtFR( nHdwFrameId)
|
||||
frHdw = EgtFR( nHdwFrameId)
|
||||
end
|
||||
local vMacro = EgtSplitString( sMacro, '_')
|
||||
|
||||
local nProcLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PRC)
|
||||
|
||||
-- recupero solido ( se non calcolato non vengono utilizzate)
|
||||
@@ -4769,17 +4879,83 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest)
|
||||
local nMainExtrusionId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_MAIN)
|
||||
local nOrigMainId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_ORIGMAIN)
|
||||
|
||||
-- calcolo il punto centrale della lavorazione
|
||||
local ptCenter = Point3d( dPosX, dPosY, dPosZ)
|
||||
|
||||
-- gestione particolare per traverso superiore ad arco
|
||||
if EgtGetType( nOutlineId) == GDB_TY.CRV_ARC then
|
||||
local nProfileLayId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE)
|
||||
local nProfileId = EgtGetFirstNameInGroup( nProfileLayId, WIN_PRF_MAIN)
|
||||
|
||||
-- calcolo outline del telaio sul canalino della ferramenta
|
||||
local nRefOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i')
|
||||
local nOffsetId = EgtCopyGlob( nRefOutlineId, nPartId)
|
||||
local dGapDelta = EgtGetInfo( nProfileId, WIN_GAPDELTA, 'd')
|
||||
EgtOffsetCurve( nOffsetId, - dGapDelta)
|
||||
|
||||
-- recupero origine sulla curva di offset a partire dai frame dell'anta
|
||||
local nHdwSashLayerId = EgtGetFirstNameInGroup( nSashId, WIN_HDW_FRAME)
|
||||
local sHdwName = EgtIf( sOrigin == 'AB', 'B', 'C') .. '.FA1'
|
||||
local nHdwSashId = EgtGetLastNameInGroup( nHdwSashLayerId, sHdwName)
|
||||
local _, _, dParRef = EgtPointCurveDist( EgtSP( nHdwSashId), nOffsetId)
|
||||
local dLen = EgtCurveLengthAtParam( nOffsetId, dParRef)
|
||||
dLen = dLen + dPosX
|
||||
local dPar = EgtCurveParamAtLength( nOffsetId, dLen)
|
||||
local ptOrig = EgtUP( nOffsetId, dPar)
|
||||
|
||||
-- ricostruisco il frame in base alla nuova origine
|
||||
local vtDir = EgtUV( nOffsetId, dPar, -1)
|
||||
if sSide == 'FT1' or sSide == 'FA1' then
|
||||
frHdw = Frame3d( ptOrig, - vtDir, vtDir ^ Z_AX(), Z_AX())
|
||||
elseif sSide == 'FT2' or sSide == 'FA2' then
|
||||
local vtDirIn = Vector3d( vtDir)
|
||||
vtDirIn:rotate( Z_AX(), 90)
|
||||
local dFrameGapDeltaZ = EgtGetInfo( nProfileId, WIN_GAPDELTAZ, 'd')
|
||||
frHdw = Frame3d( ptOrig - dFrameGapDeltaZ * Z_AX(), - vtDir, vtDir ^ vtDirIn, vtDirIn)
|
||||
elseif sSide == 'FT3' or sSide == 'FA3' then
|
||||
local b3FrameProfile = GetProfileLocalBox( nProfileId)
|
||||
local dGapDeltaZ2 = b3FrameProfile:getDimY()
|
||||
frHdw = Frame3d( ptOrig - dGapDeltaZ2 * Z_AX(), - vtDir, vtDir ^ -Z_AX(), -Z_AX())
|
||||
end
|
||||
|
||||
-- calcolo il centro della lavorazione riferito al nuovo frame
|
||||
ptCenter = Point3d( 0, dPosY, dPosZ)
|
||||
|
||||
EgtErase( nOffsetId)
|
||||
end
|
||||
|
||||
local vMacro = EgtSplitString( sMacro, '_')
|
||||
if vMacro[1] == 'FRESATA' then
|
||||
elseif vMacro[1] == 'ASOLA' then
|
||||
local ptCenter = Point3d( dPosX, dPosY, dPosZ)
|
||||
local dLength = tonumber( vMacro[2])
|
||||
local dWidth = tonumber( vMacro[3])
|
||||
local dHeight = tonumber( vMacro[4])
|
||||
local ptP1 = ptCenter + ( dLength / 2 - dWidth) * X_AX() + dWidth * Y_AX()
|
||||
local ptP2 = ptCenter - ( dLength / 2 - dWidth) * X_AX() + dWidth * Y_AX()
|
||||
elseif vMacro[1] == 'ASOLA' or vMacro[1] == 'MANIGLIA' then
|
||||
|
||||
local dLength, dWidth, dHeight
|
||||
if vMacro[1] == 'ASOLA' then
|
||||
dLength = tonumber( vMacro[2])
|
||||
dWidth = tonumber( vMacro[3])
|
||||
dHeight = tonumber( vMacro[4])
|
||||
-- NB in alcune macro ASOLA il secondo parametro non è la width ma la width/2 !
|
||||
-- TODO Al momento sembra che questo avvenga solo quando il suo valore è 8. Da verificare
|
||||
if abs( dWidth - 8) < GEO.EPS_SMALL then
|
||||
dWidth = dWidth * 2
|
||||
end
|
||||
elseif vMacro[1] == 'MANIGLIA' and vMacro[2] == '160' then
|
||||
-- macro speciale che corrisponde ad ASOLA_216_12_56 quindi forzo direttamente i valori
|
||||
-- TODO gestione di queste macro non parlanti
|
||||
dLength = 216
|
||||
dWidth = 12
|
||||
dHeight = 56
|
||||
elseif vMacro[1] == 'MANIGLIA' then -- and vMacro[2] == '15'
|
||||
-- corrisponde ad ASOLA_69_12_30
|
||||
dLength = 69
|
||||
dWidth = 12
|
||||
dHeight = 30
|
||||
end
|
||||
local ptP1 = ptCenter + ( dLength / 2 - dWidth / 2) * X_AX() + dWidth / 2 * Y_AX()
|
||||
local ptP2 = ptCenter - ( dLength / 2 - dWidth / 2) * X_AX() + dWidth / 2 * Y_AX()
|
||||
local nPocketOutlineId = EgtCurveCompoFromPoints( nProcLayerId, { ptP1, ptP2})
|
||||
EgtAddCurveCompoArcTg( nPocketOutlineId, ptCenter - dLength / 2 * X_AX())
|
||||
EgtAddCurveCompoArcTg( nPocketOutlineId, ptCenter + dLength / 2 * X_AX(), false)
|
||||
EgtAddCurveCompoArcTg( nPocketOutlineId, ptCenter - ( dLength / 2 - dWidth / 2) * X_AX() - dWidth / 2 * Y_AX())
|
||||
EgtAddCurveCompoArcTg( nPocketOutlineId, ptCenter + ( dLength / 2 - dWidth / 2) * X_AX() - dWidth / 2 * Y_AX(), false)
|
||||
EgtCloseCurveCompo( nPocketOutlineId)
|
||||
EgtSetColor( nPocketOutlineId, EgtStdColor( 'GRAY'))
|
||||
-- setto info di lavorazione
|
||||
EgtSetInfo( nPocketOutlineId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.PROFILING)
|
||||
@@ -4789,20 +4965,16 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest)
|
||||
EgtModifyCurveThickness( nPocketOutlineId, - dHeight)
|
||||
-- aggiornamento del solido
|
||||
if s_bCalcSolid then
|
||||
-- costruisco asola come volume chiuso per eseguire operazioni booleane con il solido e la creo più grande per non avere geometrie a filo
|
||||
local dExtra = 1
|
||||
-- costruisco asola come volume chiuso per eseguire operazioni booleane con il solido
|
||||
local nOutlineId = EgtCopyGlob( nPocketOutlineId, nSolidLayerId)
|
||||
EgtAddCurveCompoLineTg( nOutlineId, dExtra)
|
||||
EgtAddCurveCompoLineTg( nOutlineId, dExtra, false)
|
||||
EgtCloseCurveCompo( nOutlineId)
|
||||
EgtMove( nOutlineId, dExtra * Z_AX())
|
||||
local nSolidId = EgtSurfTmByRegionExtrusion( nProcLayerId, nOutlineId, - ( dHeight + dExtra) * Z_AX())
|
||||
EgtTransform( nSolidId, frHdwFrame)
|
||||
EgtMove( nOutlineId, Z_AX())
|
||||
local nSolidId = EgtSurfTmByRegionExtrusion( nProcLayerId, nOutlineId, - ( dHeight + 1) * Z_AX())
|
||||
EgtTransform( nSolidId, frHdw)
|
||||
EgtSurfTmSubtract( nMainExtrusionId, nSolidId)
|
||||
EgtErase( {nSolidId, nOutlineId})
|
||||
end
|
||||
-- porto la lavorazione in globale
|
||||
EgtTransform( nPocketOutlineId, frHdwFrame)
|
||||
EgtTransform( nPocketOutlineId, frHdw)
|
||||
|
||||
elseif vMacro[1] == 'TASCA' then
|
||||
elseif vMacro[1] == 'VITE' then
|
||||
@@ -4815,20 +4987,20 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest)
|
||||
dRadius = 2.5
|
||||
dDepth = 4
|
||||
end
|
||||
local ptCenter = Point3d( dPosX, dPosY, dPosZ)
|
||||
local nHoleId = EgtCircle( nProcLayerId, ptCenter, dRadius)
|
||||
EgtMove( nHoleId, Z_AX())
|
||||
EgtModifyCurveExtrusion( nHoleId, Z_AX())
|
||||
EgtModifyCurveThickness( nHoleId, - dDepth)
|
||||
EgtTransform( nHoleId, frHdwFrame)
|
||||
EgtTransform( nHoleId, frHdw)
|
||||
EgtSetInfo( nHoleId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE)
|
||||
|
||||
elseif vMacro[1] == 'FORO' then
|
||||
local ptCenter = Point3d( dPosX, dPosY, dPosZ)
|
||||
local sDiameter = EgtReplaceString( vMacro[2], 'D', '')
|
||||
local dRadius = tonumber( sDiameter) / 2
|
||||
local nHoleId = EgtCircle( nProcLayerId, ptCenter, dRadius)
|
||||
-- setto info di lavorazione
|
||||
EgtModifyCurveExtrusion( nHoleId, Z_AX())
|
||||
-- TODO : come gestire profondità non definita?
|
||||
local dDepth = tonumber(25)
|
||||
if #vMacro == 3 then
|
||||
dDepth = tonumber( vMacro[3])
|
||||
@@ -4840,12 +5012,12 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest)
|
||||
if s_bCalcSolid then
|
||||
local nSolidHoleId = EgtSurfTmByRegionExtrusion( nProcLayerId, nHoleId, - ( dDepth + 1) * Z_AX())
|
||||
EgtMove( nSolidHoleId, Z_AX())
|
||||
EgtTransform( nSolidHoleId, frHdwFrame)
|
||||
EgtTransform( nSolidHoleId, frHdw)
|
||||
EgtSurfTmSubtract( nMainExtrusionId, nSolidHoleId)
|
||||
EgtErase( nSolidHoleId)
|
||||
end
|
||||
-- porto la lavorazione in globale
|
||||
EgtTransform( nHoleId, frHdwFrame)
|
||||
EgtTransform( nHoleId, frHdw)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4889,24 +5061,115 @@ end
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
----------------------------------- ACCESSORI ----------------------------------
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che indidivua i parametri di trim della curva nCrvId in base al geo delle curve prev e next ( ricavate dalle info di nAuxCrv)
|
||||
local function GetTrimParamsByPrevAndNext( nCrvId, nAuxCrvId, sGeoRef)
|
||||
|
||||
local nAuxGrp = EgtGetParent( nCrvId)
|
||||
-- recupero curve prev e next di riferimento
|
||||
local nPrevCrv = EgtGetInfo( nAuxCrvId, WIN_PREV_OUTLINES, 'i')
|
||||
local nNextCrv = EgtGetInfo( nAuxCrvId, WIN_NEXT_OUTLINES, 'i')
|
||||
if not nPrevCrv or not nNextCrv then
|
||||
-- gestione speciale per soglia dove prev e next non sono settati
|
||||
local nRefGrp = EgtGetParent( nAuxCrvId)
|
||||
nPrevCrv = EgtGetLastInGroup( nRefGrp)
|
||||
nNextCrv = EgtGetNext( nAuxCrvId)
|
||||
end
|
||||
|
||||
-- recupero le curve del geo di interesse
|
||||
local nPrevPart = EgtGetInfo( nPrevCrv, WIN_REF_PART, 'i')
|
||||
local nPrevGeo = EgtGetFirstNameInGroup( nPrevPart, WIN_GEO)
|
||||
local nPrevRef = EgtGetFirstNameInGroup( nPrevGeo, sGeoRef)
|
||||
local nPrevCopy = EgtCopyGlob( nPrevRef, nAuxGrp)
|
||||
EgtExtendCurveStartByLen( nPrevCopy, 1000)
|
||||
EgtExtendCurveEndByLen( nPrevCopy, 1000)
|
||||
local nNextPart = EgtGetInfo( nNextCrv, WIN_REF_PART, 'i')
|
||||
local nNextGeo = EgtGetFirstNameInGroup( nNextPart, WIN_GEO)
|
||||
local nNextRef = EgtGetFirstNameInGroup( nNextGeo, sGeoRef)
|
||||
local nNextCopy = EgtCopyGlob( nNextRef, nAuxGrp)
|
||||
EgtExtendCurveStartByLen( nNextCopy, 1000)
|
||||
EgtExtendCurveEndByLen( nNextCopy, 1000)
|
||||
|
||||
-- recupero punti di intersezione
|
||||
local ptS = EgtIP( nCrvId, nPrevCopy, ORIG())
|
||||
local dParS = EgtCurveParamAtPoint( nCrvId, ptS)
|
||||
local ptE = EgtIP( nCrvId, nNextCopy, ORIG())
|
||||
local dParE = EgtCurveParamAtPoint( nCrvId, ptE)
|
||||
|
||||
EgtErase( { nPrevCopy, nNextCopy})
|
||||
|
||||
return dParS, dParE
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che calcola e disegna la soglia
|
||||
local function CalcThreshold( nOutlineId)
|
||||
local function CalcThreshold( nOutlineId, nAreaId)
|
||||
-- recupero il profilo della soglia
|
||||
local nProfileGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE)
|
||||
local nProfileLay = EgtGetFirstNameInGroup( nProfileGrp, WIN_FRAME)
|
||||
local nProfileId = EgtGetFirstNameInGroup( nProfileLay, WIN_SASH_THRESHOLD)
|
||||
local nProfileId = GetOutlineProfileId( nOutlineId)
|
||||
local dLenTot = 0
|
||||
|
||||
-- disegno
|
||||
local nAuxGrp = GetAuxLayer()
|
||||
local nStm = CreateProfileSurf( nOutlineId, nProfileId, WIN_THRESHOLD, 0, nAuxGrp)
|
||||
EgtSetColor( nStm, Color3d( 128, 128, 128))
|
||||
EgtSetName( nStm, WIN_THRESHOLD)
|
||||
local nStm = CreateProfileSurf( nOutlineId, nProfileId, WIN_SECTION, 0, nAuxGrp)
|
||||
if nStm then
|
||||
EgtSetColor( nStm, Color3d( 128, 128, 128))
|
||||
EgtSetName( nStm, WIN_THRESHOLD)
|
||||
dLenTot = EgtCurveLength( nOutlineId)
|
||||
end
|
||||
|
||||
-- se slide window ci sono parti extra da estrudere in corrispondenza delle ante fisse
|
||||
local bSlideWindow = EgtGetInfo( nAreaId, WIN_SLIDE_WINDOW, 'b') or false
|
||||
if bSlideWindow then
|
||||
-- 1) soglia extra per parte mobile
|
||||
local nGuideId = EgtCopyGlob( nOutlineId, nAuxGrp)
|
||||
local dParS, dParE = GetTrimParamsByPrevAndNext( nGuideId, nOutlineId, WIN_IN)
|
||||
EgtTrimCurveStartEndAtParam( nGuideId, dParS, dParE)
|
||||
local vMovableSections = EgtGetNameInGroup( nProfileId, WIN_MOVABLE .. WIN_SECTION)
|
||||
for i = 1, #vMovableSections do
|
||||
local nStmExtra = CreateProfileSurfById( nGuideId, nProfileId, vMovableSections[i], 0, nAuxGrp)
|
||||
EgtSetColor( nStmExtra, Color3d( 128, 128, 128))
|
||||
EgtSetName( nStmExtra, WIN_MOVABLE .. WIN_SECTION)
|
||||
end
|
||||
dLenTot = dLenTot + #vMovableSections * EgtCurveLength( nGuideId)
|
||||
EgtErase( nGuideId)
|
||||
|
||||
-- 2) soglia extra per le sottoante fisse
|
||||
-- recupero i profili extra da estrudere
|
||||
local vExtraSections = EgtGetNameInGroup( nProfileId, WIN_FIXED .. WIN_SECTION)
|
||||
if #vExtraSections > 0 then
|
||||
-- cerco tutte le sottoante fisse
|
||||
local vChildren = EgtGetInfo( nOutlineId, WIN_SASH_CHILDREN, 'vi')
|
||||
for i = 1, #vChildren do
|
||||
local nSashAreaId = EgtGetParent( EgtGetParent( vChildren[i]))
|
||||
local nSashType = EgtGetInfo( nSashAreaId, WIN_SASHTYPE, 'i')
|
||||
if nSashType == WIN_SASHTYPES.SLIDE_FIXED then
|
||||
|
||||
local nGuideId = EgtCopyGlob( vChildren[i], nAuxGrp)
|
||||
EgtExtendCurveStartByLen( nGuideId, 1000)
|
||||
EgtExtendCurveEndByLen( nGuideId, 1000)
|
||||
|
||||
-- trim della guida con il geo dei pezzi vicini
|
||||
local nOutlineId = EgtGetInfo( vChildren[i], WIN_COPY, 'i')
|
||||
local dParS, dParE = GetTrimParamsByPrevAndNext( nGuideId, nOutlineId, WIN_OUT)
|
||||
EgtTrimCurveStartEndAtParam( nGuideId, dParS, dParE)
|
||||
|
||||
for j = 1, #vExtraSections do
|
||||
local nStmExtra = CreateProfileSurfById( nGuideId, nProfileId, vExtraSections[j], 0, nAuxGrp)
|
||||
EgtSetColor( nStmExtra, Color3d( 128, 128, 128))
|
||||
EgtSetName( nStmExtra, WIN_FIXED .. WIN_THRESHOLD)
|
||||
end
|
||||
|
||||
-- aggiorno lunghezza ( TODO da gestire separatamente con i tipi di soglia)
|
||||
dLenTot = dLenTot + #vExtraSections * EgtCurveLength( nGuideId)
|
||||
EgtErase( nGuideId)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- salvo info lunghezza
|
||||
local nAreaGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREA .. '*')
|
||||
EgtSetInfo( nAreaGrp, WIN_THRESHOLD_LEN, EgtCurveLength( nOutlineId))
|
||||
|
||||
EgtSetInfo( nAreaGrp, WIN_THRESHOLD_LEN, dLenTot)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -4924,27 +5187,10 @@ local function CalcWaterdrip( nPartId, nOutlineId, nAreaId, bDraw)
|
||||
-- gruppi per i conti
|
||||
local nGrp = EgtGroup( nPartId)
|
||||
|
||||
-- recupero punto di incontro con pezzo precedente
|
||||
local nPrevId = EgtGetInfo( nOutlineId, WIN_PREV_OUTLINES, 'i')
|
||||
local nPrevPart = EgtGetInfo( nPrevId, WIN_REF_PART, 'i')
|
||||
local nPrevGeo = EgtGetFirstNameInGroup( nPrevPart, WIN_GEO)
|
||||
local nPrevCrv = EgtGetFirstNameInGroup( nPrevGeo, WIN_IN)
|
||||
local nPrevCopy = EgtCopyGlob( nPrevCrv, nGrp)
|
||||
EgtExtendCurveStartByLen( nPrevCopy, 200)
|
||||
local ptPrev = EgtIP( nOutlineId, nPrevCopy, ORIG())
|
||||
-- recupero punto di incontro con pezzo successivo
|
||||
local nNextId = EgtGetInfo( nOutlineId, WIN_NEXT_OUTLINES, 'i')
|
||||
local nNextPart = EgtGetInfo( nNextId, WIN_REF_PART, 'i')
|
||||
local nNextGeo = EgtGetFirstNameInGroup( nNextPart, WIN_GEO)
|
||||
local nNextCrv = EgtGetFirstNameInGroup( nNextGeo, WIN_IN)
|
||||
local nNextCopy = EgtCopyGlob( nNextCrv, nGrp)
|
||||
EgtExtendCurveEndByLen( nNextCopy, 200)
|
||||
local ptNext = EgtIP( nOutlineId, nNextCopy, ORIG())
|
||||
-- salvo i parametri nei punti di intersezione
|
||||
local dParPrev = EgtCurveParamAtPoint( nOutlineId, ptPrev, 100 * GEO.EPS_SMALL)
|
||||
local dParNext = EgtCurveParamAtPoint( nOutlineId, ptNext, 100 * GEO.EPS_SMALL)
|
||||
-- recupero parametri di intersezione con i pezzi vicini
|
||||
local dParPrev, dParNext = GetTrimParamsByPrevAndNext( nOutlineId, nOutlineId, WIN_IN)
|
||||
local vParams = { dParPrev, dParNext}
|
||||
|
||||
|
||||
-- verifico se outline va spezzato ulteriormente a causa di montanti
|
||||
local nBottomRail = EgtGetInfo( nOutlineId, WIN_REF_BOTTOMRAIL_PART, 'i')
|
||||
if not nBottomRail then -- se ha bottomrail gli split non causano interruzioni nel gocciolatoio
|
||||
@@ -5040,7 +5286,7 @@ local function CalcGaskets( nAreaId, bDraw)
|
||||
if bThreshold then
|
||||
-- gestione speciale per soglia che non ha pezzo associato
|
||||
local nMainProfileId = GetOutlineProfileId( vOrigOutlines[i])
|
||||
tParts[i] = { nId = GDB_ID.NULL, nProfileId = nMainProfileId, frProfile = nil}
|
||||
tParts[i] = { nProfileId = nMainProfileId, frProfile = nil}
|
||||
vOutlines[i] = vOrigOutlines[i]
|
||||
else
|
||||
local nPartId = FindAssociatedPart( vOrigOutlines[i], false)
|
||||
@@ -5048,7 +5294,7 @@ local function CalcGaskets( nAreaId, bDraw)
|
||||
local nMainProfileId = EgtGetFirstNameInGroup( nProfileLayId, WIN_PRF_MAIN)
|
||||
local nFrameId = EgtGetFirstNameInGroup( nMainProfileId, WIN_SECTIONFRAME)
|
||||
local frProfile = EgtFR( nFrameId, GDB_ID.ROOT)
|
||||
tParts[i] = { nId = nPartId, nProfileId = nMainProfileId, frProfile = frProfile}
|
||||
tParts[i] = { nProfileId = nMainProfileId, frProfile = frProfile}
|
||||
vOutlines[i] = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i')
|
||||
end
|
||||
end
|
||||
@@ -5190,7 +5436,7 @@ function WinCalculate.AddAccessories( nAreaId, bDraw)
|
||||
local bThreshold = EgtGetInfo( nAreaId, WIN_THRESHOLD, 'b') or false
|
||||
if bThreshold then
|
||||
-- soglia
|
||||
CalcThreshold( nBottomId)
|
||||
CalcThreshold( nBottomId, nAreaId)
|
||||
else
|
||||
-- gocciolatoio
|
||||
local nPartId = EgtGetInfo( nBottomId, WIN_REF_PART, 'i')
|
||||
|
||||
@@ -89,7 +89,7 @@ end
|
||||
local function CreateFrameCurves( nLayerId, nType, dWidth, dHeight, dVal)
|
||||
|
||||
-- rettangolo
|
||||
if nType == WIN_FRAME_TYPE.RECT then
|
||||
if nType == WIN_FRAME_TYPES.RECT then
|
||||
-- telaio rettangolare
|
||||
local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0))
|
||||
EgtSetName( nBottomId, WIN_BOTTOM)
|
||||
@@ -101,7 +101,7 @@ local function CreateFrameCurves( nLayerId, nType, dWidth, dHeight, dVal)
|
||||
EgtSetName( nLeftId, WIN_LEFT)
|
||||
|
||||
-- lato top inclinato
|
||||
elseif nType == WIN_FRAME_TYPE.CHAMFER_SIDE then
|
||||
elseif nType == WIN_FRAME_TYPES.CHAMFER_SIDE then
|
||||
-- dHeight è l'altezza del lato sx, dVal è l'altezza del lato dx
|
||||
local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0))
|
||||
EgtSetName( nBottomId, WIN_BOTTOM)
|
||||
@@ -113,7 +113,7 @@ local function CreateFrameCurves( nLayerId, nType, dWidth, dHeight, dVal)
|
||||
EgtSetName( nLeftId, WIN_LEFT)
|
||||
|
||||
-- triangular arch
|
||||
elseif nType == WIN_FRAME_TYPE.CHAMFER then
|
||||
elseif nType == WIN_FRAME_TYPES.CHAMFER then
|
||||
-- dHeight è l'altezza dei lati verticali, dVal è l'altezza complessiva della finestra
|
||||
local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0))
|
||||
EgtSetName( nBottomId, WIN_BOTTOM)
|
||||
@@ -127,7 +127,7 @@ local function CreateFrameCurves( nLayerId, nType, dWidth, dHeight, dVal)
|
||||
EgtSetName( nLeftId, WIN_LEFT)
|
||||
|
||||
-- arco a tutto sesto
|
||||
elseif nType == WIN_FRAME_TYPE.ROUND_ARC then
|
||||
elseif nType == WIN_FRAME_TYPES.ROUND_ARC then
|
||||
local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0))
|
||||
EgtSetName( nBottomId, WIN_BOTTOM)
|
||||
local nRightId = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dWidth, dHeight - 0.5 * dWidth, 0))
|
||||
@@ -138,7 +138,7 @@ local function CreateFrameCurves( nLayerId, nType, dWidth, dHeight, dVal)
|
||||
EgtSetName( nLeftId, WIN_LEFT)
|
||||
|
||||
-- arco ribassato
|
||||
elseif nType == WIN_FRAME_TYPE.SEGMENTAL_ARC then
|
||||
elseif nType == WIN_FRAME_TYPES.SEGMENTAL_ARC then
|
||||
-- dHeight è l'altezza dei lati verticali, dVal è l'altezza complessiva della finestra
|
||||
local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0))
|
||||
EgtSetName( nBottomId, WIN_BOTTOM)
|
||||
@@ -150,7 +150,7 @@ local function CreateFrameCurves( nLayerId, nType, dWidth, dHeight, dVal)
|
||||
EgtSetName( nLeftId, WIN_LEFT)
|
||||
|
||||
-- arco a tutto sesto
|
||||
elseif nType == WIN_FRAME_TYPE.POINTED_ARC then
|
||||
elseif nType == WIN_FRAME_TYPES.POINTED_ARC then
|
||||
-- dHeight è l'altezza dei lati verticali, dVal è l'altezza complessiva della finestra
|
||||
-- verifico che le due altezze abbiano valori sensati per realizzare i due archi
|
||||
if dVal - dHeight < 0.5 * dWidth then
|
||||
@@ -169,7 +169,7 @@ local function CreateFrameCurves( nLayerId, nType, dWidth, dHeight, dVal)
|
||||
EgtSetName( nLeftId, WIN_LEFT)
|
||||
|
||||
-- triangolo
|
||||
elseif nType == WIN_FRAME_TYPE.TRG then
|
||||
elseif nType == WIN_FRAME_TYPES.TRG then
|
||||
local nBottomId = EgtLine( nLayerId, ORIG(), Point3d( dWidth, 0, 0))
|
||||
EgtSetName( nBottomId, WIN_BOTTOM)
|
||||
local nEdge1Id = EgtLine( nLayerId, Point3d( dWidth, 0, 0), Point3d( dVal, dHeight, 0))
|
||||
@@ -197,6 +197,7 @@ function WinCreate.CreateFrame( nType, vJoints, dWidth, dHeight, dHeight2)
|
||||
-- disegno outline
|
||||
CreateFrameCurves( nTmpLay, nType, dWidth, dHeight, dHeight2)
|
||||
local nFrameAreaId = WinCreate.CreateGenFrame( EgtGetAllInGroup( nTmpLay), vJoints)
|
||||
EgtSetInfo( nFrameAreaId, WIN_FRAME_TYPE, nType)
|
||||
EgtErase( nTmpLay)
|
||||
|
||||
return nFrameAreaId
|
||||
|
||||
@@ -64,8 +64,6 @@ _G.SetProfilePath = SetProfilePath
|
||||
----------------------------------------------------------------------------------
|
||||
local function WinCreate_ImportProfile()
|
||||
_G.sProfile = WDG.PROFILE
|
||||
--WinCreate.ImportProfile( WDG.PROFILE)
|
||||
-- TODO da decommentare e sostituire alla riga sopra quando la modifica è nel programma
|
||||
if _G.sProfilePath then
|
||||
WinCreate.ImportProfile( _G.sProfilePath .. '\\' .. WDG.PROFILE .. '.nge')
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user