diff --git a/Designing/WinLib/WinCalculate.lua b/Designing/WinLib/WinCalculate.lua index 453cf3f..d31d094 100644 --- a/Designing/WinLib/WinCalculate.lua +++ b/Designing/WinLib/WinCalculate.lua @@ -5629,6 +5629,12 @@ local function DrawHingesPreview( nOutlineId, nLayerId) local dDimL = 80 local dDimW = 20 + local nBaseOutlineId = EgtGetInfo( nOutlineId, WIN_COPY, 'i') + local dDelta = ( EgtSP( nOutlineId) - EgtSP( nBaseOutlineId)) * Z_AX() + if dDelta < GEO.EPS_SMALL then + return + end + local vtDir = EgtSV( nOutlineId) local vtDirIn = Vector3d( vtDir) vtDirIn:rotate( Z_AX(), -90) @@ -5740,13 +5746,18 @@ local function DrawHandlePreview( nOutlineId, sHandleSide, dHandleH, nLayerId, b local nProfileLayId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) local nMainProfileId = EgtGetFirstNameInGroup( nProfileLayId, WIN_PRF_MAIN) local b3Profile = GetProfileLocalBox( nMainProfileId) + local dSide = abs( b3Profile:getMin():getX() + 0.5 * b3Profile:getDimX()) + -- correzione per caso speciale di telaio e ante allineate ( euristica) local nParentAreaId = EgtGetParent( EgtGetParent( nOutlineId)) - local nSashType = EgtGetInfo( nParentAreaId, WIN_SASHTYPE, 'i') - local dSide = 0.5 * b3Profile:getDimX() - if nSashType == WIN_SASHTYPES.ACTIVE or nSashType == WIN_SASHTYPES.ACTIVE_IN then - dSide = 0.33 * b3Profile:getDimX() + local nSashType = EgtGetInfo( nParentAreaId, WIN_SASHTYPE, 'i') or WIN_SASHTYPES.NULL + if nSashType == WIN_SASHTYPES.NULL then + local nBaseOutlineId = EgtGetInfo( nOutlineId, WIN_COPY, 'i') + local dDelta = ( EgtSP( nOutlineId) - EgtSP( nBaseOutlineId)) * Z_AX() + if dDelta < GEO.EPS_SMALL then + dSide = dSide + 9 + end end - + -- punto su cui centrare la maniglia local ptC = ptRef - dHandleH * vtDir + dSide * vtDirIn + Z_AX() @@ -7012,43 +7023,20 @@ local function CalcBottomRailPreview( nPreviewGrp, nOutlineId, nBottomRail, nGeo EgtErase( vCrvs) end ----------------------------------------------------------------------------------- -local function GetBorderFromAdjacentSash( nOutlineId, nGrpId) - -- recupero l'anta active adiacente - local nBaseOutlineId = EgtGetInfo( nOutlineId, WIN_COPY, 'i') - local nSouId = EgtGetInfo( nBaseOutlineId, WIN_SOU, 'i') - local vChildrenIds = EgtGetInfo( nSouId, WIN_CHILD, 'vi') - local nActiveChildId = EgtIf( vChildrenIds[1] == nBaseOutlineId, vChildrenIds[2], vChildrenIds[1]) - -- recupero il suo geo out - local nActiveOutlineId = EgtGetInfo( nActiveChildId, WIN_COPY, 'i') - local nActivePartId = EgtGetInfo( nActiveOutlineId, WIN_REF_PART, 'i') - local nActiveGeoId = EgtGetFirstNameInGroup( nActivePartId, WIN_GEO) - local nActiveOutId = EgtGetFirstNameInGroup( nActiveGeoId, WIN_GEO_OUT) - - local nCrvId = EgtCopyGlob( nActiveOutId, nGrpId) - EgtInvertCurve( nCrvId) - return nCrvId -end - ---------------------------------------------------------------------------------- local function CalcPartPreview( nPartId, nPreviewGrp) local nOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i') local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) - -- verifico se è anta con parti contro anta active - local nParentAreaId = EgtGetParent( EgtGetParent( nOutlineId)) - local nSashType = EgtGetInfo( nParentAreaId, WIN_SASHTYPE, 'i') - local bInactiveSash = ( nSashType == WIN_SASHTYPES.INACTIVE or nSashType == WIN_SASHTYPES.INACTIVE_IN or nSashType == WIN_SASHTYPES.INACTIVE_OUT or nSashType == WIN_SASHTYPES.ACTIVE_OUT) - -- recupero il tipo di giunzioni local nStartJoint = EgtGetInfo( nOutlineId, WIN_STARTJOINT, 'i') local nEndJoint = EgtGetInfo( nOutlineId, WIN_ENDJOINT, 'i') local nAreaId - -- se non ha giunzioni short e non è inactive come preview posso considerare direttamente la regione del geo - if nStartJoint ~= WIN_PART_JNT.SHORT and nEndJoint ~= WIN_PART_JNT.SHORT and not bInactiveSash then + -- se non ha giunzioni short come preview posso considerare direttamente la regione del geo + if nStartJoint ~= WIN_PART_JNT.SHORT and nEndJoint ~= WIN_PART_JNT.SHORT then local nGeoSurf = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_SURF) nAreaId = EgtCopyGlob( nGeoSurf, nPreviewGrp) EgtSetStatus( nAreaId, GDB_ST.ON) @@ -7062,18 +7050,12 @@ local function CalcPartPreview( nPartId, nPreviewGrp) local nProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN) local b3Profile = GetProfileLocalBox( nProfileId) - -- a) curva out : se outline è split di anta inactive considero il bordo del pezzo active, altrimenti ricalcolo curva del geo ( non posso utilizzare direttamente quella - -- del geo perchè non deve avere estensioni) - local sProfileType = EgtGetInfo( nProfileId, WIN_PRF_TYPE) - if sProfileType == WIN_SASH_INACTIVE or sProfileType == WIN_FRENCH_OUT then - GetBorderFromAdjacentSash( nOutlineId, nGrpTmp) - else - local nOutId = EgtCopy( nOutlineId, nGrpTmp) - EgtOffsetCurve( nOutId, b3Profile:getMax():getX()) - local nGeoOut = EgtGetFirstNameInGroup( nGeoLayerId, WIN_OUT) - CopyInfo( nOutId, nGeoOut, WIN_TANG_START, false) - CopyInfo( nOutId, nGeoOut, WIN_TANG_END, false) - end + -- a) curva out : ricalcolo curva del geo ( non posso utilizzare direttamente quella del geo perchè non deve avere estensioni) + local nOutId = EgtCopy( nOutlineId, nGrpTmp) + EgtOffsetCurve( nOutId, b3Profile:getMax():getX()) + local nGeoOut = EgtGetFirstNameInGroup( nGeoLayerId, WIN_OUT) + CopyInfo( nOutId, nGeoOut, WIN_TANG_START, false) + CopyInfo( nOutId, nGeoOut, WIN_TANG_END, false) -- b) curva in local nInId = EgtCopy( nOutlineId, nGrpTmp) @@ -7092,15 +7074,10 @@ local function CalcPartPreview( nPartId, nPreviewGrp) -- recupero la bisettrice dal geo EgtCopyGlob( vGeoLeft[1], nGrpTmp) - -- curva aux : nel caso di curva su split french con anta inactive considero il bordo del pezzo active, altrimenti considero l'out del pezzo precedente - local sProfileType = EgtGetInfo( vPrevProfileId[1], WIN_PRF_TYPE) - if sProfileType == WIN_SASH_INACTIVE or sProfileType == WIN_FRENCH_OUT then - GetBorderFromAdjacentSash( abs( vPrevOutlineId[1]), nGrpTmp) - else - local nCrvId = EgtCopyGlob( abs( vPrevOutlineId[1]), nGrpTmp) - local b3Profile = GetProfileLocalBox( vPrevProfileId[1]) - EgtOffsetCurve( nCrvId, b3Profile:getMax():getX()) - end + -- curva aux : considero l'out del pezzo precedente + local nCrvId = EgtCopyGlob( abs( vPrevOutlineId[1]), nGrpTmp) + local b3Profile = GetProfileLocalBox( vPrevProfileId[1]) + EgtOffsetCurve( nCrvId, b3Profile:getMax():getX()) else for i = 1, #vPrevOutlineId do @@ -7131,22 +7108,17 @@ local function CalcPartPreview( nPartId, nPreviewGrp) end else -- full - -- nel caso di curva su split french con anta inactive bisogna considerare il bordo del pezzo active, altrimenti considero l'out del pezzo precedente - local sProfileType = EgtGetInfo( vPrevProfileId[i], WIN_PRF_TYPE) - if sProfileType == WIN_SASH_INACTIVE or sProfileType == WIN_FRENCH_OUT then - GetBorderFromAdjacentSash( abs( vPrevOutlineId[i]), nGrpTmp) - else - local nCrvId = EgtCopy( abs( vPrevOutlineId[i]), nGrpTmp) - local b3Profile = GetProfileLocalBox( vPrevProfileId[i]) - local dOffs = b3Profile:getMax():getX() - if vPrevOutlineId[i] < 0 then - EgtInvertCurve( nCrvId) - dOffs = - b3Profile:getMin():getX() - end - EgtOffsetCurve( nCrvId, dOffs) - CopyInfo( nCrvId, vGeoLeft[i], WIN_TANG_START, false) - CopyInfo( nCrvId, vGeoLeft[i], WIN_TANG_END, false) + -- considero l'out del pezzo precedente + local nCrvId = EgtCopy( abs( vPrevOutlineId[i]), nGrpTmp) + local b3Profile = GetProfileLocalBox( vPrevProfileId[i]) + local dOffs = b3Profile:getMax():getX() + if vPrevOutlineId[i] < 0 then + EgtInvertCurve( nCrvId) + dOffs = - b3Profile:getMin():getX() end + EgtOffsetCurve( nCrvId, dOffs) + CopyInfo( nCrvId, vGeoLeft[i], WIN_TANG_START, false) + CopyInfo( nCrvId, vGeoLeft[i], WIN_TANG_END, false) end end end @@ -7162,15 +7134,9 @@ local function CalcPartPreview( nPartId, nPreviewGrp) EgtRelocateGlob( nCrvId, nInId, GDB_IN.BEFORE) -- curva aux - local nAuxCrv - local sProfileType = EgtGetInfo( vNextProfileId[1], WIN_PRF_TYPE) - if sProfileType == WIN_SASH_INACTIVE or sProfileType == WIN_FRENCH_OUT then - nAuxCrv = GetBorderFromAdjacentSash( abs( vNextOutlineId[1]), nGrpTmp) - else - nAuxCrv = EgtCopyGlob( abs( vNextOutlineId[1]), nGrpTmp) - local b3Profile = GetProfileLocalBox( vNextProfileId[1]) - EgtOffsetCurve( nAuxCrv, b3Profile:getMax():getX()) - end + local nAuxCrv = EgtCopyGlob( abs( vNextOutlineId[1]), nGrpTmp) + local b3Profile = GetProfileLocalBox( vNextProfileId[1]) + EgtOffsetCurve( nAuxCrv, b3Profile:getMax():getX()) EgtRelocateGlob( nAuxCrv, nInId, GDB_IN.BEFORE) else @@ -7201,22 +7167,16 @@ local function CalcPartPreview( nPartId, nPreviewGrp) end else -- full - - local sProfileType = EgtGetInfo( vNextProfileId[i], WIN_PRF_TYPE) - if sProfileType == WIN_SASH_INACTIVE or sProfileType == WIN_FRENCH_OUT then - nCrvId = GetBorderFromAdjacentSash( abs( vNextOutlineId[i]), nGrpTmp) - else - local b3Profile = GetProfileLocalBox( vNextProfileId[i]) - nCrvId = EgtCopyGlob( abs( vNextOutlineId[i]), nGrpTmp) - local dOffs = b3Profile:getMax():getX() - if vNextOutlineId[i] < 0 then - EgtInvertCurve( nCrvId) - dOffs = - b3Profile:getMin():getX() - end - EgtOffsetCurve( nCrvId, dOffs) - CopyInfo( nCrvId, vGeoRight[i], WIN_TANG_START, false) - CopyInfo( nCrvId, vGeoRight[i], WIN_TANG_END, false) + local b3Profile = GetProfileLocalBox( vNextProfileId[i]) + nCrvId = EgtCopyGlob( abs( vNextOutlineId[i]), nGrpTmp) + local dOffs = b3Profile:getMax():getX() + if vNextOutlineId[i] < 0 then + EgtInvertCurve( nCrvId) + dOffs = - b3Profile:getMin():getX() end + EgtOffsetCurve( nCrvId, dOffs) + CopyInfo( nCrvId, vGeoRight[i], WIN_TANG_START, false) + CopyInfo( nCrvId, vGeoRight[i], WIN_TANG_END, false) end EgtRelocateGlob( nCrvId, nInId, GDB_IN.BEFORE) end @@ -7226,8 +7186,21 @@ local function CalcPartPreview( nPartId, nPreviewGrp) nAreaId = CalcGeoRegion( vIds, nPreviewGrp) EgtErase( nGrpTmp) end - + -- sistemo la regione + local nParentAreaId = EgtGetParent( EgtGetParent( nOutlineId)) + local nAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.SASH then + -- se anta traslazione per gestire meglio i casi di telaio e ante allineati + EgtMove( nAreaId, Vector3d( 0, 0, - 0.1)) + -- se anta con parte ricevente traslazione per evitare sovrapposizione con parte battente + local nSashType = EgtGetInfo( nParentAreaId, WIN_SASHTYPE, 'i') + if nSashType == WIN_SASHTYPES.INACTIVE or nSashType == WIN_SASHTYPES.INACTIVE_IN or nSashType == WIN_SASHTYPES.ACTIVE_OUT then + EgtMove( nAreaId, Vector3d( 0, 0, - 0.1)) + elseif nSashType == WIN_SASHTYPES.INACTIVE_OUT then + EgtMove( nAreaId, Vector3d( 0, 0, - 0.2)) + end + end local color = EgtGetColor( nPartId) EgtSetColor( nAreaId, color) -- estraggo il contorno