- aggiunto disegno ferramenta

- correzioni minori.
This commit is contained in:
SaraP
2025-03-12 14:44:52 +01:00
parent f5e2faef7f
commit d5d9c05223
2 changed files with 161 additions and 39 deletions
+1
View File
@@ -348,5 +348,6 @@ WIN_HARDWARE = 'Hardware'
WIN_HDW_FAVOURITE = 'HdwFavourite'
WIN_HDW_HANDLE = 'HdwHandle'
WIN_HDW_FRAME = 'HdwFrame'
WIN_HDW_HANDLE_HEIGHT = 'HdwHandleH'
---------------------------------------------------------------------
return WinConst
+160 -39
View File
@@ -2586,7 +2586,7 @@ local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail
for k = 1, 3 do
-- recupero i dowels della fila k-esima
local vDowels = EgtGetNameInGroup( nPrevProfileId, WIN_DOWEL .. 'Row' .. tostring( k))
if not vDowels then
if #vDowels == 0 then
break
end
-- recupero il dowel nella posizione più problematica ( per le ante è quello più esterno, per il telaio quello più interno)
@@ -2664,7 +2664,7 @@ local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail
for k = 1, 3 do
-- recupero i dowels sulla fila k-esima
local vDowels = EgtGetNameInGroup( nProfileId, WIN_DOWEL .. 'Row' .. tostring(k))
if not vDowels then
if #vDowels == 0 then
break
end
-- recupero il dowel nella posizione più problematica ( per le ante è quello più esterno, per il telaio quello più interno)
@@ -3862,6 +3862,121 @@ end
----------------------------------------------------------------------------------
---------------------------------- FERRAMENTA ----------------------------------
----------------------------------------------------------------------------------
-- funzione che disegna le cerniere
local function DrawHinges( nPartId, nOutlineId)
-- dimensioni cerniere
local dDimH = 16
local dDimV = 70
local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID)
local nBaseOutlineId = EgtGetInfo( nOutlineId, WIN_COPY, 'i')
local dDelta = ( EgtSP( nOutlineId) - EgtSP( nBaseOutlineId)) * Z_AX()
local pt1 = EgtSP( nOutlineId) - dDelta * Z_AX()
local pt2 = EgtEP( nOutlineId) - dDelta * Z_AX()
local vtDir = EgtSV( nOutlineId)
local vtDirIn = Vector3d( vtDir)
vtDirIn:rotate( Z_AX(), -90)
local nStm1 = EgtSurfTmBox( nSolidLayerId, pt1, pt1 + vtDir * dDimV + vtDirIn * dDimH, pt1 + vtDirIn * dDimH, dDelta)
local nStm2 = EgtSurfTmBox( nSolidLayerId, pt2, pt2 - vtDir * dDimV + vtDirIn * dDimH, pt2 + vtDirIn * dDimH, dDelta)
EgtSetColor( nStm1, Color3d( 128, 128, 128))
EgtSetColor( nStm2, Color3d( 128, 128, 128))
end
---------------------------------------------------------------------
-- funzione che disegna la maniglia
local function DrawHandle( nPartId, nOutlineId, sHandleSide, dHandleH)
-- dati della maniglia
local dRad1 = 40
local dRad2 = 19
local dH = 9
local dLen1 = 53
local dLen2 = 115
local dRadH = 12
local dFillet = 10
local dOffset = 27
local ptRef = EgtIf( sHandleSide == 'Sx', EgtSP( nOutlineId), EgtEP( nOutlineId))
local vtRef = EgtIf( sHandleSide == 'Sx', EgtSV( nOutlineId), - EgtEV( nOutlineId))
local vtDirIn = Vector3d( vtRef)
vtDirIn:rotate( Z_AX(), EgtIf( sHandleSide == 'Sx', 90, -90))
-- recupero il riferimento rispetto a cui leggere l'altezza maniglia
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')
-- recupero di quanto spostare la maniglia rispetto all'outline
local nGeoLayId = EgtGetFirstNameInGroup( nPartId, WIN_GEO)
local nGeoOut = EgtGetFirstNameInGroup( nGeoLayId, WIN_OUT)
local dDeltaIn = dOffset - ( EgtSP( nOutlineId) - EgtSP( nGeoOut)) * vtDirIn
-- punto su cui centrare la maniglia
local ptC = ptRef + ( dHandleH + dGapHardware) * vtRef + dDeltaIn * vtDirIn
local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID)
local nCrv1 = EgtRectangle2P( nSolidLayerId, ptC - dRad1 * Y_AX() - dRad2 * X_AX(), ptC + dRad1 * Y_AX() + dRad2 * X_AX())
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())
EgtTransform( nGuide, frTransf)
local nSection = EgtCircle( nSolidLayerId, EgtSP( nGuide), dRadH)
local nStm2 = EgtSurfTmSwept( nSolidLayerId, nSection, nGuide, true)
EgtSurfTmAdd( nStm1, nStm2)
EgtSetColor( nStm1, Color3d( 128, 128, 128))
EgtErase( { nCrv1, nGuide, nSection, nStm2})
end
---------------------------------------------------------------------
-- funzione che disegna la ferramenta
local function DrawSashHardware( nAreaId, nRefAreaId)
-- recupero pezzi interessati dalla ferramenta
local nOutlineLayId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE)
local nLeftId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_LEFT)
local nLeftPartId = EgtGetInfo( nLeftId, WIN_REF_PART, 'i')
local nRightId = EgtGetFirstNameInGroup( nOutlineLayId, WIN_RIGHT)
local nRightPartId = EgtGetInfo( nRightId, WIN_REF_PART, 'i')
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( nRightPartId, nRightId)
else
DrawHinges( nLeftPartId, nLeftId)
end
-- 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 = EgtGetInfo( nRefAreaId, WIN_HDW_HANDLE_HEIGHT, 'd') or 500
if sHandleSide == 'Sx' then
-- maniglia su right e cerniere su left
DrawHandle( nRightPartId, nRightId, sHandleSide, dHandleH)
DrawHinges( nLeftPartId, nLeftId)
else
-- maniglia su left e cerniere su right
DrawHandle( nLeftPartId, nLeftId, sHandleSide, dHandleH)
DrawHinges( nRightPartId, nRightId)
end
end
end
---------------------------------------------------------------------
-- funzione che calcola i dati necessari per la ferramenta
local function SearchSash( nAreaId, SashList)
-- verifico il tipo
local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i')
@@ -3890,9 +4005,9 @@ local function SearchSash( nAreaId, SashList)
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)
EgtSetInfo( nOutlineCopyId, WIN_GAPDELTAZ .. 2, b3SashProfileType:getDimY())
EgtOffsetCurve( nOutlineCopyId, - dGapDelta)
table.insert( vOutlineCopy, nOutlineCopyId)
nOutlineId = EgtGetNext( nOutlineId)
end
local tSash = { nAreaId = nAreaId, ptCenter = b3Outline:getCenter()}
@@ -3949,40 +4064,42 @@ local function SearchSash( nAreaId, SashList)
EgtSetStatus( nFrameFrameLayerId, GDB_ST.OFF)
end
-- ricavo aria lato telaio
local sProfileType = EgtGetInfo( nSouId, WIN_PROFILETYPE)
local nProfileId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE, 'i')
local nFrameProfileId = EgtGetFirstNameInGroup( nProfileId, WIN_FRAME, 'i')
local nFrameProfileTypeId = EgtGetFirstNameInGroup( nFrameProfileId, sProfileType, 'i')
local dGapDeltaOut = EgtGetInfo( nFrameProfileTypeId, WIN_GAPDELTAOUT, 'd')
local dFrameGapDeltaZ = EgtGetInfo( nFrameProfileTypeId, WIN_GAPDELTAZ, 'd')
if EgtGetName( nSouId) == WIN_SPLIT then
-- se dervia da split verifico il lato
if not AreSameVectorApprox( EgtSV( nSouId), EgtSV( nBaseOutlineId)) then
dGapDeltaOut = - dGapDeltaOut
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 dGapDeltaOut = EgtGetInfo( nFrameProfileTypeId, WIN_GAPDELTAOUT, 'd')
local dFrameGapDeltaZ = EgtGetInfo( nFrameProfileTypeId, WIN_GAPDELTAZ, 'd')
if EgtGetName( nSouId) == WIN_SPLIT then
-- se dervia da split verifico il lato
if not AreSameVectorApprox( EgtSV( nSouId), EgtSV( nBaseOutlineId)) then
dGapDeltaOut = - dGapDeltaOut
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)
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)
end
end
tSash.Frame = tFrame
@@ -4158,12 +4275,12 @@ local function AddHardwareForSash( nFrameId, bOnlyRequest)
local nFrameOutlineId = EgtGetInfo( nSouId, WIN_COPY, 'i')
nPartId = EgtGetInfo( nFrameOutlineId, WIN_REF_PART, 'i')
local nHdwFrameLayerId = EgtGetFirstNameInGroup( nSouAreaId, WIN_HDW_FRAME)
local nHdwFrameId = EgtGetFirstNameInGroup( nHdwFrameLayerId, nSashIndex .. '.' .. sSashPart .. '.' .. sSide)
local nHdwFrameId = EgtGetLastNameInGroup( nHdwFrameLayerId, nSashIndex .. '.' .. sSashPart .. '.' .. sSide)
frHdwFrame = EgtFR( nHdwFrameId)
elseif sPart == 'ANTA' then
nPartId = EgtGetInfo( nOutlineId, WIN_REF_PART, 'i')
local nHdwFrameLayerId = EgtGetFirstNameInGroup( nSashId, WIN_HDW_FRAME)
local nHdwFrameId = EgtGetFirstNameInGroup( nHdwFrameLayerId, sSashPart .. '.' .. sSide)
local nHdwFrameId = EgtGetLastNameInGroup( nHdwFrameLayerId, sSashPart .. '.' .. sSide)
frHdwFrame = EgtFR( nHdwFrameId)
end
local vMacro = EgtSplitString( sMacro, '_')
@@ -4257,6 +4374,10 @@ local function AddHardwareForSash( nFrameId, bOnlyRequest)
-- Chiudo file Output in lettura
fhOutput:close()
-- disegno la ferramenta
for i = 1, #SashList do
DrawSashHardware( SashList[i].nAreaId, nFrameId)
end
end
---------------------------------------------------------------------