diff --git a/Designing/WinLib/WinCalculate.lua b/Designing/WinLib/WinCalculate.lua index b758892..1fb1431 100644 --- a/Designing/WinLib/WinCalculate.lua +++ b/Designing/WinLib/WinCalculate.lua @@ -3120,7 +3120,7 @@ local function DrawOpening( nAreaId) local nFactor = 7 local nPattern = 0xAAAA local nType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') - local bStippled = ( nType == WIN_SASHTYPES.INACTIVE) + local bStippled = ( nType == WIN_SASHTYPES.INACTIVE or nType == WIN_SASHTYPES.INACTIVE_IN or nType == WIN_SASHTYPES.INACTIVE_OUT) -- calcolo la curva di riferimento per il disegno dell'apertura local nOutlineLayId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) @@ -3204,7 +3204,7 @@ local function DrawOpening( nAreaId) ptS, ptE = ptE, ptS end local nCompo = EgtCurveCompoFromPoints( nOpeningLayId, { ptS, ptE}) - if nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_LEFT or nOpeningType == WIN_OPENING_TYPES.LIFTSLIDE_RIGHT then + if nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_LEFT or nOpeningType == WIN_OPENING_TYPES.COPLANARSLIDE_RIGHT then EgtAddCurveCompoLine( nCompo, ptS - dCoeff * dLen1 * Y_AX(), false) end local dAng = EgtIf( bRight, 135, 45) @@ -3212,9 +3212,7 @@ local function DrawOpening( nAreaId) EgtLinePDL( nOpeningLayId, ptE, - dAng, dCoeff * dLen0) elseif nOpeningType == WIN_OPENING_TYPES.FIXED then - -- fisso ( solo forma rettangolare) - EgtLine( nOpeningLayId, EgtSP( nGuideId), EgtUP( nGuideId, 2)) - EgtLine( nOpeningLayId, EgtUP( nGuideId, 1), EgtUP( nGuideId, 3)) + -- nessun disegno elseif nOpeningType == WIN_OPENING_TYPES.PIVOT then -- bilico rettangolare @@ -4078,21 +4076,22 @@ end --------------------------------------------------------------------- -- funzione che disegna la maniglia -local function DrawHandle( nPartId, nOutlineId, sHandleSide, dHandleH, nSolidLayerId, bVasistas) +local function DrawHandle( nOutlineId, sHandleSide, dHandleH, nSolidLayerId) -- dati della maniglia - local dBase1 = EgtIf( bVasistas, 20, 40) - local dBase2 = EgtIf( bVasistas, 20, 19) + local dBase1 = 40 + local dBase2 = 18 local dH = 9 local dLen1 = 53 local dLen2 = 115 - local dRadH = 12 + local dRadH = 12.5 local dFillet = 10 - local dOffset = 27 + local dOffset = 33 + local nPartId = EgtGetInfo( nOutlineId, WIN_REF_PART, 'i') local ptRef = EgtIf( sHandleSide == 'Sx', EgtSP( nOutlineId), EgtEP( nOutlineId)) - local vtRef = EgtIf( sHandleSide == 'Sx', EgtSV( nOutlineId), - EgtEV( nOutlineId)) - local vtDirIn = Vector3d( vtRef) + local vtDir = EgtIf( sHandleSide == 'Sx', EgtSV( nOutlineId), - EgtEV( nOutlineId)) + local vtDirIn = Vector3d( vtDir) vtDirIn:rotate( Z_AX(), EgtIf( sHandleSide == 'Sx', 90, -90)) -- recupero il riferimento rispetto a cui leggere l'altezza maniglia @@ -4105,16 +4104,16 @@ local function DrawHandle( nPartId, nOutlineId, sHandleSide, dHandleH, nSolidLay local dDeltaIn = dOffset - ( EgtSP( nOutlineId) - EgtSP( nGeoOut)) * vtDirIn -- punto su cui centrare la maniglia - local ptC = ptRef + ( dHandleH + dGapHardware) * vtRef + dDeltaIn * vtDirIn - - local nCrv1 = EgtRectangle2P( nSolidLayerId, ptC - dBase1 * Y_AX() - dBase2 * X_AX(), ptC + dBase1 * Y_AX() + dBase2 * X_AX()) + local ptC = ptRef + ( dHandleH + dGapHardware) * vtDir + dDeltaIn * vtDirIn + + local nCrv1 = EgtRectangle2P( nSolidLayerId, ptC - dBase1 * vtDir - dBase2 * vtDirIn, ptC + dBase1 * 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 nCrv3 = EgtArc2PR( nSolidLayerId, EgtEP( nCrv2), EgtSP( nCrv4), dFillet, false) local nGuide = EgtCurveCompo( nSolidLayerId, { nCrv2, nCrv3, nCrv4}) - local frTransf = Frame3d( ptC, Z_AX(), Y_AX(), - X_AX()) + local frTransf = Frame3d( ptC, Z_AX(), vtDir, Z_AX() ^ vtDir) EgtTransform( nGuide, frTransf) local nSection = EgtCircle( nSolidLayerId, EgtSP( nGuide), dRadH) local nStm2 = EgtSurfTmSwept( nSolidLayerId, nSection, nGuide, true) @@ -4129,59 +4128,85 @@ end -- funzione che disegna la ferramenta local function DrawSashHardware( nAreaId, nRefAreaId, nSolidLayerId) - local nOpeningType = EgtGetInfo( nAreaId, WIN_OPENING_TYPE, 'i') - local bVasistas = ( nOpeningType == WIN_OPENING_TYPES.TILTONLY_TOP) - - -- recupero pezzi interessati dalla ferramenta local nOutlineLayId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) - local nLeftId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_LEFT) - local nRightId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_RIGHT) - if bVasistas then - nLeftId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_BOTTOM) - nRightId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_TOP) - end - local nLeftPartId = EgtGetInfo( nLeftId, WIN_REF_PART, 'i') - local nRightPartId = EgtGetInfo( nRightId, WIN_REF_PART, 'i') + local nOpeningType = EgtGetInfo( nAreaId, WIN_OPENING_TYPE, 'i') + if nOpeningType == WIN_OPENING_TYPES.NULL or nOpeningType == WIN_OPENING_TYPES.FIXED then + return - local nSashType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') - -- se anta ricevente solo cerniere - if nSashType == WIN_SASHTYPES.INACTIVE or nSashType == WIN_SASHTYPES.INACTIVE_IN or nSashType == WIN_SASHTYPES.INACTIVE_OUT or nSashType == WIN_SASHTYPES.SLIDE_FIXED then - -- individuo il lato che poggia sul telaio - local nBaseOutlineId = EgtGetInfo( nLeftId, WIN_COPY, 'i') - local bLeftInactive = EgtGetInfo( nBaseOutlineId, WIN_CRV_ON_FRENCH_SPLIT, 'b') or false - if bLeftInactive then - DrawHinges( nRightId, nSolidLayerId) - else - DrawHinges( nLeftId, nSolidLayerId) - end + elseif nOpeningType == WIN_OPENING_TYPES.TILTONLY_TOP then + -- cerniere sul pezzo inferiore + local nBottomId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_BOTTOM) + DrawHinges( nBottomId, nSolidLayerId) - -- se anta battente o singola ha maniglia e cerniere - else - -- recupero i dati della maniglia - local sHandleSide = EgtGetInfo( nRefAreaId, WIN_HDW_HANDLE) or 'Sx' - local dHandleH = 500 - if bVasistas then - dHandleH = 0.5 * EgtCurveLength( nLeftId) - else - 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 + -- recupero lato maniglia + local vOptions = EgtGetInfo( nRefAreaId, WIN_HDW_OPTIONS, 'vs') or {} + local sHandleSide = 'Sx' + local nOutlineId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_RIGHT) + for i = 1, #vOptions do + local vString = EgtSplitString( vOptions[i], '=') + if vString[1] == 'PosizioneManiglia' then + if vString[2] == 'destra' then + sHandleSide = 'Dx' + nOutlineId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_LEFT) + elseif vString[2] == 'sopra' then + nOutlineId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_TOP) end + break + end + end + -- altezza maniglia è fissata a metà del lato ( con compensazione per frame di riferimento della ferramenta) + local nPartId = EgtGetInfo( nOutlineId, WIN_REF_PART, 'i') + local nProfileLayId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) + local nProfileId = EgtGetFirstNameInGroup( nProfileLayId, EgtIf( sHandleSide == 'Sx', WIN_PRF_START, WIN_PRF_END)) + local dGapHardware = EgtGetInfo( nProfileId, WIN_GAPDELTA, 'd') + local dHandleH = 0.5 * EgtCurveLength( nOutlineId) - dGapHardware + + -- disegno maniglia + DrawHandle( nOutlineId, sHandleSide, dHandleH, nSolidLayerId) + + else + local nSashType = EgtGetInfo( nAreaId, WIN_SASHTYPE, 'i') or WIN_SASHTYPES.NULL + + -- recupero pezzi interessati dalla ferramenta + local nLeftId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_LEFT) + local nRightId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_RIGHT) + + -- recupero dati della maniglia + local sHandleSide = EgtGetInfo( nRefAreaId, WIN_HDW_HANDLE) + local dHandleH = 500 + 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 - if sHandleSide == 'Sx' then - -- maniglia su right e cerniere su left - DrawHandle( nRightPartId, nRightId, sHandleSide, dHandleH, nSolidLayerId, bVasistas) - DrawHinges( nLeftId, nSolidLayerId) - else - -- maniglia su left e cerniere su right - DrawHandle( nLeftPartId, nLeftId, sHandleSide, dHandleH, nSolidLayerId, bVasistas) - DrawHinges( nRightId, nSolidLayerId) + -- cerniere + if nSashType == WIN_SASHTYPES.INACTIVE or nSashType == WIN_SASHTYPES.INACTIVE_OUT or + nSashType == WIN_SASHTYPES.ACTIVE or nSashType == WIN_SASHTYPES.ACTIVE_OUT then + -- le cerniere vanno messe sul lato che poggia sul telaio + local nBaseOutlineId = EgtGetInfo( nLeftId, WIN_COPY, 'i') + local bLeftInactive = EgtGetInfo( nBaseOutlineId, WIN_CRV_ON_FRENCH_SPLIT, 'b') or false + DrawHinges( EgtIf( bLeftInactive, nRightId, nLeftId), nSolidLayerId) + elseif nSashType == WIN_SASHTYPES.NULL then + -- è il lato senza maniglia + if sHandleSide == 'Sx' then + DrawHinges( nLeftId, nSolidLayerId) + else + DrawHinges( nRightId, nSolidLayerId) + end + end + + -- maniglia + if nSashType == WIN_SASHTYPES.ACTIVE or nSashType == WIN_SASHTYPES.ACTIVE_IN or nSashType == WIN_SASHTYPES.NULL then + if sHandleSide == 'Sx' then + DrawHandle( nRightId, sHandleSide, dHandleH, nSolidLayerId) + else + DrawHandle( nLeftId, sHandleSide, dHandleH, nSolidLayerId) + end end end end @@ -4404,6 +4429,12 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest) 'S_NAME=' .. nFavourite .. '\n' .. 'RECORDID=15A' .. '\n' + -- recupero il tipo di apertura + local nOpeningType = WIN_OPENING_TYPES.NULL + if #SashList > 0 then + nOpeningType = EgtGetInfo( SashList[1].nAreaId, WIN_OPENING_TYPE, 'i') + end + if #SashList >= 1 and abs( SashList[1].LHeight - SashList[1].RHeight) < GEO.EPS_SMALL then sText = sText .. 'HBB=' .. tostring( SashList[1].LHeight) .. '\n' else @@ -4438,8 +4469,12 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest) sText = sText .. 'FINESTRAPORTAFINESTRA=Finestra' .. '\n' .. - 'Q=1' .. '\n' .. - 'MANOSERRAMENTO=' .. sHandle .. '\n' + 'Q=1' .. '\n' + + -- opzione manoserramento ( non per vasistas) + if nOpeningType ~= WIN_OPENING_TYPES.TILTONLY_TOP then + sText = sText .. 'MANOSERRAMENTO=' .. sHandle .. '\n' + end local vOptions = EgtGetInfo( nFrameId, WIN_HDW_OPTIONS, 'vs') or {} for i = 1, #vOptions do