diff --git a/Profiles/Profilo78 - Offset - Copy (39).nge b/Profiles/Profilo78 - Offset - Copy (39).nge new file mode 100644 index 0000000..637fca2 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (39).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (40).nge b/Profiles/Profilo78 - Offset - Copy (40).nge new file mode 100644 index 0000000..f3fc101 Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (40).nge differ diff --git a/Profiles/Profilo78 - Offset - Copy (41).nge b/Profiles/Profilo78 - Offset - Copy (41).nge new file mode 100644 index 0000000..e6fce8c Binary files /dev/null and b/Profiles/Profilo78 - Offset - Copy (41).nge differ diff --git a/Profiles/Profilo78 - Offset.nge b/Profiles/Profilo78 - Offset.nge index 637fca2..a5ac450 100644 Binary files a/Profiles/Profilo78 - Offset.nge and b/Profiles/Profilo78 - Offset.nge differ diff --git a/Profiles/WinConst.lua b/Profiles/WinConst.lua index 24f9261..a14faac 100644 --- a/Profiles/WinConst.lua +++ b/Profiles/WinConst.lua @@ -197,6 +197,7 @@ WIN_MAINGUIDE = 'MainGuide' WIN_STARTGUIDE = 'StartGuide' WIN_ENDGUIDE = 'EndGuide' WIN_SRF_MAIN = 'MainSurface' +WIN_SRF_ORIGMAIN = 'OrigMainSurface' WIN_SRF_START = 'StartSurface' WIN_SRF_END = 'EndSurface' @@ -215,6 +216,8 @@ WIN_DWL_RAILBOTTOMPERPSTART = 'RailBottomPerpStart' WIN_DWL_RAILBOTTOMPERPEND = 'RailBottomPerpEnd' WIN_DWL_RAILBOTTOMPARASTART = 'RailBottomParaStart' WIN_DWL_RAILBOTTOMPARAEND = 'RailBottomParaEnd' +WIN_DWL_SPLITPERPSTART = 'SplitPerpStart' +WIN_DWL_SPLITPERPEND = 'SplitPerpEnd' --------------------------------------------------------------------- return WinConst diff --git a/Profiles/WinLib/WinCalculate.lua b/Profiles/WinLib/WinCalculate.lua index 92e805c..f78bdab 100644 --- a/Profiles/WinLib/WinCalculate.lua +++ b/Profiles/WinLib/WinCalculate.lua @@ -132,7 +132,68 @@ function WinCalculate.CreatePartFromArea( nAreaId) nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*') end end - + +function WinCalculate.AddSplitDowelToParts( nAreaId) + -- recupero tipo di area + local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH then + -- recupero pezzi outline + local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE) + local nOutlineId = EgtGetFirstInGroup( nOutlineLayerId) + while nOutlineId do + WinCalculate.AddSplitDowelToExtrusion( nOutlineId, nAreaType, false) + -- se di tipo bottom + local sName = EgtGetName( nOutlineId) + if sName == WIN_BOTTOM then + -- se ha BottomRail + local nBottomRail = EgtGetInfo( nOutlineLayerId, WIN_BOTTOMRAIL, 'i') + if nBottomRail and nBottomRail == 1 then + WinCalculate.AddSplitDowelToExtrusion( nOutlineId, nAreaType, true) + end + end + nOutlineId = EgtGetNext( nOutlineId) + end + end + -- verifico se c'e' uno split + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT) + if nSplitLayerId then + local nSplitType = EgtGetInfo( nSplitLayerId, WIN_SPLITTYPE, 'i') + local bCalcSplit = false + -- se split di tipo montante + if nSplitType == WIN_SPLITTYPES.MULLION then + bCalcSplit = true + elseif nSplitType == WIN_SPLITTYPES.FRENCH then + bCalcSplit = false + else + -- o split dell'anta + local nParentArea = nAreaId + local nParentType = nAreaType + while nParentArea and nParentType ~= WIN_AREATYPES.FRAME and nParentType ~= WIN_AREATYPES.SASH do + nParentArea = EgtGetParent( nParentArea) + nParentType = EgtGetInfo( nParentArea, WIN_AREATYPE, 'i') + end + if nParentArea and nParentType == WIN_AREATYPES.SASH then + bCalcSplit = true + else + bCalcSplit = true + end + end + if bCalcSplit then + local nSplitId = EgtGetFirstInGroup( nSplitLayerId) + if nSplitId then + -- creo pezzo split + WinCalculate.AddSplitDowelToExtrusion( nSplitId, nAreaType, false) + end + end + end + -- verifico se ci sono aree + local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*') + while nChildAreaId do + -- lancio costruzione pezzi di quell'area + WinCalculate.AddSplitDowelToParts( nChildAreaId) + nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*') + end +end -- funzione che dato un gruppo contenente curve ordinate che creano una curva chiusa, -- ne estende/taglia i contorni per ottenere una curva chiusa continua @@ -1527,6 +1588,9 @@ function WinCalculate.MakeSolidByExtrusion(nGeoId, nOutlineId, nMainProfileId, n local nMainOutlineId = EgtGetFirstNameInGroup( nMainProfileId, WIN_SECTION) local nMainExtrusionId = EgtSurfTmSwept( nSolidLayerId, nMainOutlineId, nGuideId, false, WIN_SURF_APPROX) EgtSetName( nMainExtrusionId, WIN_SRF_MAIN) + local nOrigMainExtrusionId = EgtCopy( nMainExtrusionId, nSolidLayerId) + EgtSetName( nOrigMainExtrusionId, WIN_SRF_ORIGMAIN) + EgtSetStatus( nOrigMainExtrusionId, GDB_ST.OFF) -- posiziono il profilo Start local nRefStartProfileId = EgtGetFirstNameInGroup( nStartProfileId, WIN_REF) local b3RefStartProfile = EgtGetBBoxGlob(nRefStartProfileId, GDB_BB.STANDARD) @@ -1649,18 +1713,16 @@ function WinCalculate.MakeSolidByExtrusion(nGeoId, nOutlineId, nMainProfileId, n -- recupero profondita' d'inizio e fine local sStart = WIN_DWL_TOPPARASTART local sEnd = WIN_DWL_TOPPARAEND - if sOutlineName == WIN_BOTTOM then + if sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM then sStart = WIN_DWL_BOTTOMPARASTART sEnd = WIN_DWL_BOTTOMPARAEND - elseif sOutlineName == WIN_SPLIT then + end + if sOutlineName == WIN_SPLIT then local sStartType = EgtGetInfo( nStartProfileId, WIN_PRF_TYPE) if ( sStartType and sStartType == WIN_RAIL_BOTTOM) or sPrevOutlineName == WIN_SPLIT then sStart = WIN_DWL_RAILBOTTOMPARASTART sEnd = WIN_DWL_RAILBOTTOMPARAEND end - elseif sPrevOutlineName == WIN_BOTTOM then - sStart = WIN_DWL_BOTTOMPARASTART - sEnd = WIN_DWL_BOTTOMPARAEND end --local sStart = EgtIf( sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM or sOutlineName == WIN_BOTTOMRAIL, WIN_DWL_BOTTOMPARASTART, WIN_DWL_TOPPARASTART) --local sEnd = EgtIf( sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM or sOutlineName == WIN_BOTTOMRAIL, WIN_DWL_BOTTOMPARAEND, WIN_DWL_TOPPARAEND) @@ -1810,18 +1872,16 @@ function WinCalculate.MakeSolidByExtrusion(nGeoId, nOutlineId, nMainProfileId, n -- recupero profondita' d'inizio e fine local sStart = WIN_DWL_TOPPARASTART local sEnd = WIN_DWL_TOPPARAEND - if sOutlineName == WIN_BOTTOM then + if sOutlineName == WIN_BOTTOM or sEndOutlineName == WIN_BOTTOM then sStart = WIN_DWL_BOTTOMPARASTART sEnd = WIN_DWL_BOTTOMPARAEND - elseif sOutlineName == WIN_SPLIT then + end + if sOutlineName == WIN_SPLIT then local sEndType = EgtGetInfo( nEndProfileId, WIN_PRF_TYPE) if ( sEndType and sEndType == WIN_RAIL_BOTTOM) or sEndOutlineName == WIN_SPLIT then sStart = WIN_DWL_RAILBOTTOMPARASTART sEnd = WIN_DWL_RAILBOTTOMPARAEND end - elseif sEndOutlineName == WIN_BOTTOM then - sStart = WIN_DWL_BOTTOMPARASTART - sEnd = WIN_DWL_BOTTOMPARAEND end -- ciclo sui fori trovati local nOrigDowelId = EgtGetFirstNameInGroup( nMainProfileId, WIN_DOWEL .. '*') @@ -1862,25 +1922,8 @@ function WinCalculate.MakeSolidByExtrusion(nGeoId, nOutlineId, nMainProfileId, n EgtErase( { nExtrCopyId}) end --- funzione che posiziona i fori delle spine degli split, li estrude e crea il solido -function WinCalculate.AddSplitDowelToExtrusion(nOutlineId, nProfileFrameLayerId, nFrameProfileLayerId, nProfileType, nPartId, nSolidLayerId) - -- recupero l'area di cui fa parte il pezzo - local sOutlineName2 = EgtGetName( nOutlineId) - local nOutlineLayerId = EgtGetParent( nOutlineId) - local nAreaLayerId = EgtGetParent( nOutlineLayerId) - -- se profilo Bottom con BottomRail, esco - if nProfileType == WIN_PRF.BOTTOM then - local nBaseOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) - local nBottomRailId = EgtGetInfo( nBaseOutlineLayerId, WIN_BOTTOMRAIL, 'i') - if nBottomRailId and nBottomRailId == 1 then - return - end - end - -- verifico la presenza di eventuali Split - local nSplitLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_SPLIT) - if not nSplitLayerId then - return - end +-- funzione che calcola intersezione, geometrie e superfici dei dowel degli split +function CalSplitDowel( nSplitLayerId, nOutlineId, nProfileFrameLayerId, nFrameProfileLayerId, nProfileType, nPartId, nSolidLayerId) local nSplitId = EgtGetFirstInGroup( nSplitLayerId) -- se presenti, verifico se intersecano l'outline che sto analizzando @@ -1897,9 +1940,15 @@ function WinCalculate.AddSplitDowelToExtrusion(nOutlineId, nProfileFrameLayerId, EgtSetInfo( nSplitProfileId, WIN_PRF_TYPE, sSplitProfileType) EgtSetName( nSplitProfileId, WIN_PRF_SPLIT) -- recupero intersezione con lato In + local bIsGeoOut = false local nGeoLayerId = EgtGetFirstNameInGroup( nPartId, WIN_GEO) local nGeoInId = EgtGetFirstNameInGroup(nGeoLayerId, WIN_GEO_IN) local ptIntersIn = EgtIP( nGeoInId, nSplitId, EgtSP( nSplitId)) + if not ptIntersIn and nProfileType == WIN_PRF.SPLIT then + bIsGeoOut = true + nGeoInId = EgtGetFirstNameInGroup(nGeoLayerId, WIN_GEO_OUT) + ptIntersIn = EgtIP( nGeoInId, nSplitId, EgtSP( nSplitId)) + end -- recupero frame del profilo local nSplitProfileFrameId = EgtGetFirstNameInGroup( nSplitProfileId, WIN_SECTIONFRAME) local frInvertSplitProfile = EgtFR( nSplitProfileFrameId) @@ -1907,7 +1956,11 @@ function WinCalculate.AddSplitDowelToExtrusion(nOutlineId, nProfileFrameLayerId, -- lo applico a tutte le geometrie del profilo EgtTransform( EgtGetAllInGroup( nSplitProfileId), frInvertSplitProfile) -- assegno come riferimento del profilo il punto di intersezione - EgtChangeGroupFrame( nSplitProfileId, Frame3d( ptIntersIn, - EgtSV( nSplitId))) + local vtDir = - EgtSV( nSplitId) + if bIsGeoOut then + vtDir = - vtDir + end + EgtChangeGroupFrame( nSplitProfileId, Frame3d( ptIntersIn, vtDir)) -- e lo porto nel sistema di riferimento corretto @@ -1918,112 +1971,136 @@ function WinCalculate.AddSplitDowelToExtrusion(nOutlineId, nProfileFrameLayerId, -- recupero solido del pezzo local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) local nMainExtrusionId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_MAIN) + local nOrigMainExtrusionId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_ORIGMAIN) -- creo fori per spine su Split local nDowelLayerId = EgtGetFirstNameInGroup( nPartId, WIN_DOWEL) - local nPrevOutlineId, nEndOutlineId = GetPrevNextOutline( nProfileType, nOutlineId, nOutlineLayerId) - local sOutlineName = EgtGetName( nOutlineId) - local sPrevOutlineName = EgtGetName( nPrevOutlineId) - SplitJointType = WIN_PART_JNT.FULL - if SplitJointType == WIN_PART_JNT.ANGLED then - - elseif SplitJointType == WIN_PART_JNT.FULL then - -- recupero profondita' d'inizio e fine - local sStart = WIN_DWL_TOPPERPSTART - local sEnd = WIN_DWL_TOPPERPEND - if nProfileType == WIN_PRF.BOTTOM then - sStart = WIN_DWL_BOTTOMPERPSTART - sEnd = WIN_DWL_BOTTOMPERPEND - elseif nProfileType == WIN_PRF.BOTTOMRAIL then - sStart = WIN_DWL_RAILBOTTOMPERPSTART - sEnd = WIN_DWL_RAILBOTTOMPERPEND + -- recupero profondita' d'inizio e fine + local sStart = WIN_DWL_TOPPERPSTART + local sEnd = WIN_DWL_TOPPERPEND + if nProfileType == WIN_PRF.BOTTOM then + sStart = WIN_DWL_BOTTOMPERPSTART + sEnd = WIN_DWL_BOTTOMPERPEND + elseif nProfileType == WIN_PRF.BOTTOMRAIL then + sStart = WIN_DWL_RAILBOTTOMPERPSTART + sEnd = WIN_DWL_RAILBOTTOMPERPEND + elseif nProfileType == WIN_PRF.SPLIT then + sStart = WIN_DWL_SPLITPERPSTART + sEnd = WIN_DWL_SPLITPERPEND + end + -- ciclo sui fori trovati + local nOrigDowelId = EgtGetFirstNameInGroup( nSplitProfileId, WIN_DOWEL .. '*') + while nOrigDowelId do + local dStart = EgtGetInfo( nOrigDowelId, sStart, 'd') + if not dStart then + dStart = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPERPSTART, 'd') end - -- recupero profondita' d'inizio e fine - --local sStart = EgtIf( sOutlineName == WIN_BOTTOM, WIN_DWL_BOTTOMPERPSTART, WIN_DWL_TOPPERPSTART) - --local sEnd = EgtIf( sOutlineName == WIN_BOTTOM, WIN_DWL_BOTTOMPERPEND, WIN_DWL_TOPPERPEND) - -- ciclo sui fori trovati - local nOrigDowelId = EgtGetFirstNameInGroup( nSplitProfileId, WIN_DOWEL .. '*') - while nOrigDowelId do - local dStart = EgtGetInfo( nOrigDowelId, sStart, 'd') - if not dStart then - dStart = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPERPSTART, 'd') - end - local dEnd = EgtGetInfo( nOrigDowelId, sEnd, 'd') - if not dEnd then - dEnd = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPERPEND, 'd') - end - local nDowelId = EgtCopyGlob( nOrigDowelId, nDowelLayerId) - EgtSetColor( nDowelId, Color3d( 128, 128, 128)) - local nInGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_IN) - local ptDowelCenter = EgtCP( nDowelId) - local vtPerpStartPoint = EgtSV( nOutlineId) + local dEnd = EgtGetInfo( nOrigDowelId, sEnd, 'd') + if not dEnd then + dEnd = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPERPEND, 'd') + end + local nDowelId = EgtCopyGlob( nOrigDowelId, nDowelLayerId) + EgtSetColor( nDowelId, Color3d( 128, 128, 128)) + local ptDowelCenter = EgtCP( nDowelId) + local vtPerpStartPoint = EgtSV( nOutlineId) + if bIsGeoOut then + vtPerpStartPoint:rotate( Z_AX(), -90) + else vtPerpStartPoint:rotate( Z_AX(), 90) - -- posiziono i fori e gli assegno estrusione e spessore - EgtMove( nDowelId, ( EgtSP( nInGeoId) - ptDowelCenter) * vtPerpStartPoint * vtPerpStartPoint - vtPerpStartPoint * dStart) - -- EgtMove( nDowelId, Point3d( ptDowelCenter:getX(), EgtSP( nInGeoId):getY(), ptDowelCenter:getZ()) - ptDowelCenter - vtPerpStartPoint * dStart) - EgtModifyCurveExtrusion( nDowelId, - vtPerpStartPoint) - EgtModifyCurveThickness( nDowelId, dEnd - dStart) - -- creo solido di estrusione - local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, - vtPerpStartPoint * ( dEnd - dStart + 1)) - EgtMove( nDowelExtrusionId, vtPerpStartPoint) - EgtInvertSurf( nDowelExtrusionId) - -- taglio estrusi per ottenere solido - EgtSurfTmCut( nMainExtrusionId, nDowelExtrusionId, true, false) - -- EgtSurfTmCut( nDowelExtrusionId, nExtrCopyId, true, false) - nOrigDowelId = EgtGetNextName( nOrigDowelId, WIN_DOWEL .. '*') end - elseif SplitJointType == WIN_PART_JNT.SHORT then - -- recupero profondita' d'inizio e fine - local sStart = WIN_DWL_TOPPARASTART - local sEnd = WIN_DWL_TOPPARAEND - if sOutlineName == WIN_BOTTOM then - sStart = WIN_DWL_BOTTOMPARASTART - sEnd = WIN_DWL_BOTTOMPARAEND - elseif sOutlineName == WIN_SPLIT then - local sStartType = EgtGetInfo( nSplitProfileId, WIN_PRF_TYPE) - if ( sStartType and sStartType == WIN_RAIL_BOTTOM) or sPrevOutlineName == WIN_SPLIT then - sStart = WIN_DWL_RAILBOTTOMPARASTART - sEnd = WIN_DWL_RAILBOTTOMPARAEND - end - elseif sPrevOutlineName == WIN_BOTTOM then - sStart = WIN_DWL_BOTTOMPARASTART - sEnd = WIN_DWL_BOTTOMPARAEND - end - --local sStart = EgtIf( sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM or sOutlineName == WIN_BOTTOMRAIL, WIN_DWL_BOTTOMPARASTART, WIN_DWL_TOPPARASTART) - --local sEnd = EgtIf( sOutlineName == WIN_BOTTOM or sPrevOutlineName == WIN_BOTTOM or sOutlineName == WIN_BOTTOMRAIL, WIN_DWL_BOTTOMPARAEND, WIN_DWL_TOPPARAEND) - -- ciclo sui fori trovati - local nOrigDowelId = EgtGetFirstNameInGroup( nSplitProfileId, WIN_DOWEL .. '*') - while nOrigDowelId do - local dStart = EgtGetInfo( nOrigDowelId, sStart, 'd') - if not dStart then - dStart = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPARASTART, 'd') - end - local dEnd = EgtGetInfo( nOrigDowelId, sEnd, 'd') - if not dEnd then - dEnd = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPARAEND, 'd') - end - local nDowelId = EgtCopyGlob( nOrigDowelId, nDowelLayerId) - EgtSetColor( nDowelId, Color3d( 128, 128, 128)) - local nLeftGeoId = EgtGetFirstNameInGroup( nGeoLayerId, WIN_GEO_LEFT) - local ptDowelCenter = EgtCP( nDowelId) - local vtParaStartPoint = EgtSV( nOutlineId) - -- posiziono i fori e gli assegno estrusione e spessore - EgtMove( nDowelId, ( EgtSP( nLeftGeoId) - ptDowelCenter) * vtParaStartPoint * vtParaStartPoint + vtParaStartPoint * dStart) - -- EgtMove( nDowelId, Point3d( ptDowelCenter:getX(), EgtSP( nLeftGeoId):getY(), ptDowelCenter:getZ()) - ptDowelCenter + vtParaStartPoint * dStart) - EgtModifyCurveExtrusion( nDowelId, vtParaStartPoint) - EgtModifyCurveThickness( nDowelId, dEnd - dStart) - -- creo solido di estrusione - local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, vtParaStartPoint * ( dEnd - dStart + 1)) - EgtMove( nDowelExtrusionId, - vtParaStartPoint) - EgtInvertSurf( nDowelExtrusionId) - -- taglio estrusi per ottenere solido - local nDowelExtrCopyId = EgtCopy( nDowelExtrusionId, nSolidLayerId) - EgtSurfTmCut( nDowelExtrusionId, nMainExtrusionId, true, false) - EgtSurfTmCut( nMainExtrusionId, nDowelExtrCopyId, true, false) - EgtErase( nDowelExtrCopyId) - nOrigDowelId = EgtGetNextName( nOrigDowelId, WIN_DOWEL .. '*') + -- posiziono i fori e gli assegno estrusione e spessore + EgtMove( nDowelId, ( EgtSP( nGeoInId) - ptDowelCenter) * vtPerpStartPoint * vtPerpStartPoint - vtPerpStartPoint * dStart) + -- EgtMove( nDowelId, Point3d( ptDowelCenter:getX(), EgtSP( nInGeoId):getY(), ptDowelCenter:getZ()) - ptDowelCenter - vtPerpStartPoint * dStart) + EgtModifyCurveExtrusion( nDowelId, - vtPerpStartPoint) + EgtModifyCurveThickness( nDowelId, dEnd - dStart) + -- creo solido di estrusione + local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, - vtPerpStartPoint * ( dEnd - dStart + 1)) + EgtMove( nDowelExtrusionId, vtPerpStartPoint) + EgtInvertSurf( nDowelExtrusionId) + -- taglio estrusi per ottenere solido + --local nExtrCopyId = EgtCopy( nMainExtrusionId, nSolidLayerId) + EgtSurfTmCut( nMainExtrusionId, nDowelExtrusionId, true, false) + EgtSurfTmCut( nDowelExtrusionId, nOrigMainExtrusionId, true, false) + --EgtErase( nExtrCopyId) + nOrigDowelId = EgtGetNextName( nOrigDowelId, WIN_DOWEL .. '*') + end +end + +-- funzione ricorsiva che cerca gli split che possono dare origine a dei dowel +function VerifyDowelArea( nAreaLayerId, nOutlineId, nPartId, nProfileType, nOrigAreaType) + --EgtSaveFile('c://Temp//DowelSplit.nge') + -- recupero profilo + local nProfileLayerId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nProfileFrameLayerId + if nOrigAreaType == WIN_AREATYPES.FRAME then + nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_FRAME) + elseif nOrigAreaType == WIN_AREATYPES.SASH then + nProfileFrameLayerId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_SASH) + end + -- creo layer per solido e per profili di estrusione + local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) + local nFrameProfileLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PROFILE) +-- verifico la presenza di eventuali Split + local nSplitLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_SPLIT) + if nSplitLayerId then + CalSplitDowel( nSplitLayerId, nOutlineId, nProfileFrameLayerId, nFrameProfileLayerId, nProfileType, nPartId, nSolidLayerId) + end + -- verifico la presenza di split in sotto aree + local nArea1LayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREA1) + if nArea1LayerId then + local nAreaType = EgtGetInfo( nArea1LayerId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.SPLIT then + VerifyDowelArea( nArea1LayerId, nOutlineId, nPartId, nProfileType, nOrigAreaType) end end - + local nArea2LayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREA2) + if nArea2LayerId then + local nAreaType = EgtGetInfo( nArea2LayerId, WIN_AREATYPE, 'i') + if nAreaType == WIN_AREATYPES.SPLIT then + VerifyDowelArea( nArea2LayerId, nOutlineId, nPartId, nProfileType, nOrigAreaType) + end + end +end + +-- funzione che posiziona i fori delle spine degli split, li estrude e crea il solido +function WinCalculate.AddSplitDowelToExtrusion(nOutlineId, nAreaType, bIsBottomRail) + -- ricavo tipo dal + local sPartRef = WIN_REF_PART + if bIsBottomRail then + sPartRef = WIN_BOTTOMRAIL + end + local nPartId = EgtGetInfo( nOutlineId, sPartRef, 'i') + local sName = EgtGetName( nPartId) + local nProfileType = WIN_PRF.NULL + if bIsBottomRail then + nProfileType = WIN_PRF.BOTTOMRAIL + elseif sName == WIN_TOP then + nProfileType = WIN_PRF.TOP + elseif sName == WIN_BOTTOM then + nProfileType = WIN_PRF.BOTTOM + elseif sName == WIN_LEFT then + nProfileType = WIN_PRF.LEFT + elseif sName == WIN_RIGHT then + nProfileType = WIN_PRF.RIGHT + elseif sName == WIN_VERTICAL then + nProfileType = WIN_PRF.VERTICAL + elseif sName == WIN_HORIZONTAL then + nProfileType = WIN_PRF.HORIZONTAL + elseif sName == WIN_SPLIT then + nProfileType = WIN_PRF.SPLIT + end + -- recupero l'area di cui fa parte il pezzo + local nOutlineLayerId = EgtGetParent( nOutlineId) + local nAreaLayerId = EgtGetParent( nOutlineLayerId) + -- se profilo Bottom con BottomRail, esco + if nProfileType == WIN_PRF.BOTTOM then + local nBaseOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE) + local nBottomRailId = EgtGetInfo( nBaseOutlineLayerId, WIN_BOTTOMRAIL, 'i') + if nBottomRailId and nBottomRailId == 1 then + return + end + end + -- verifico la presenza di eventuali Split + VerifyDowelArea( nAreaLayerId, nOutlineId, nPartId, nProfileType, nAreaType) end @@ -2422,25 +2499,6 @@ function WinCalculate.CalcFrameSolid(nPartId, nOutlineId, nGeoId, nOutlineLayerI EgtSetName( nEndProfileId, WIN_PRF_END) -- creo solido dai profili WinCalculate.MakeSolidByExtrusion(nGeoId, nOutlineId, nMainProfileId, nStartProfileId, nEndProfileId, nProfileType, nSolidLayerId, nAreaType) --- -- aggiungo fori spine per eventuali split --- local nAreaId = nOutlineLayerId --- local nAreaType --- -- ciclo fino a trovare un child che non sia uno split --- repeat --- nAreaId = EgtGetParent( nAreaId) --- nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') --- until not nAreaId or ( nAreaType ~= WIN_AREATYPES.SPLIT and nAreaType ~= WIN_AREATYPES.NULL) --- --- -- ciclo alla ricerca di tutti i child che siano split e di tipo mullion --- local nChildId = nOutlineLayerId --- local nAreaType --- --- repeat --- nAreaId = EgtGetParent( nAreaId) --- nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i') --- until not nAreaId or ( nAreaType ~= WIN_AREATYPES.SPLIT and nAreaType ~= WIN_AREATYPES.NULL) --- - WinCalculate.AddSplitDowelToExtrusion( nOutlineId, nProfileFrameLayerId, nFrameProfileLayerId, nProfileType, nPartId, nSolidLayerId) end -- funzione che crea il solido del Fill diff --git a/Profiles/WinOpenProjectFile.lua b/Profiles/WinOpenProjectFile.lua index ae98fab..e638f45 100644 --- a/Profiles/WinOpenProjectFile.lua +++ b/Profiles/WinOpenProjectFile.lua @@ -33,20 +33,25 @@ local WinCalculate = require( 'WinCalculate') _G.package.loaded.WinManageProject = nil local WinManageProject = require( 'WinManageProject') --- apro dialogo di scelta file -local sOpeneDirPath = 'c:\\EgtData\\EgwWindowLua\\Projects' -local FilePathList = EgtFindAllFiles( sOpeneDirPath .. '\\*.jwd') -local sDialogFile = 'CB:' -for FilePathIndex = 1, #FilePathList do - local sName = EgtSplitString( FilePathList[FilePathIndex], '.') - sDialogFile = sDialogFile .. sName[1] .. ',' -end -local sFileName = '' -local DialogRes = EgtDialogBox( 'Open Window Project', { 'Nome Progetto', sDialogFile }) -if DialogRes and DialogRes[1] then - sFileName = DialogRes[1] .. '.jwd' +local sOpenFilePath = '' +-- verifico se lanciato file in batch per test +if WINDOW and WINDOW.FILE then + sOpenFilePath = WINDOW.FILE else - return + -- altrimenti apro dialogo di scelta file + local sOpenDirPath = 'c:\\EgtData\\EgwWindowLua\\Projects' + local FilePathList = EgtFindAllFiles( sOpenDirPath .. '\\*.jwd') + local sDialogFile = 'CB:' + for FilePathIndex = 1, #FilePathList do + local sName = EgtSplitString( FilePathList[FilePathIndex], '.') + sDialogFile = sDialogFile .. sName[1] .. ',' + end + local DialogRes = EgtDialogBox( 'Open Window Project', { 'Nome Progetto', sDialogFile }) + if DialogRes and DialogRes[1] then + sOpenFilePath = sOpenDirPath .. '\\' .. DialogRes[1] .. '.jwd' + else + return + end end EgtNewFile() @@ -54,10 +59,6 @@ EgtNewFile() EgtStartCounter() --local sFileName = 'RoundArc_FixedGlass_Vertical&HorizontalSplit.jwd' -local sOpenFilePath = sOpeneDirPath .. '\\' .. sFileName -if WINDOW and WINDOW.FILE then - sOpenFilePath = WINDOW.FILE -end if not WinManageProject.ReadFromFile( sOpenFilePath) then return end @@ -68,6 +69,7 @@ WinCalculate.SetCalcSolid( true) -- creo i pezzi local nFrameId = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_AREAASTERISK) WinCalculate.CreatePartFromArea( nFrameId) +WinCalculate.AddSplitDowelToParts( nFrameId) EgtZoom( SCE_ZM.ALL)