From e48dbe7268a7ed69693c0276b51aa464feccde54 Mon Sep 17 00:00:00 2001 From: SaraP Date: Mon, 10 Jun 2024 09:13:18 +0200 Subject: [PATCH] - aggiunte lavorazioni - gestione della ferramenta anche senza il calcolo del solido. --- Profiles/WinConst.lua | 18 +++ Profiles/WinLib/WinCalculate.lua | 202 ++++++++++++++++++++++--------- 2 files changed, 160 insertions(+), 60 deletions(-) diff --git a/Profiles/WinConst.lua b/Profiles/WinConst.lua index 6a76ddd..4d59ec7 100644 --- a/Profiles/WinConst.lua +++ b/Profiles/WinConst.lua @@ -148,6 +148,7 @@ WIN_STRIP = 'Strip' WIN_ALU = 'Alu' WIN_CTRIN = 'CtrIn' WIN_OUT = 'Out' +WIN_IN = 'In' WIN_OUTOFST = 'OfstOut' WIN_CTRINOFST = 'OfstCtrIn' WIN_OFST = 'Ofst' @@ -159,6 +160,7 @@ WIN_STARTCPDELTA = 'StartCPDelta' WIN_ENDCPDELTA = 'EndCPDelta' WIN_GEOWIDTH = 'GeoWidth' WIN_GLASSTHICKNESS = 'GlassThickness' +WIN_SEMI_PROFILE = 'SemiProfileId' WIN_GEOOUTLINEBOTTOM = 'GeoOutlineBottom' @@ -200,6 +202,13 @@ WIN_GAPDELTAZ = 'GapDeltaZ' WIN_GAPDELTAIN = 'GapDeltaIn' WIN_GAPDELTAOUT = 'GapDeltaOut' +WIN_PRC_PHASE = 'PHASE' +WIN_PRC_PROFILE_TYPE = 'PROFILE_TYPE' +WIN_PRC_NTOOLS = 'NTOOLS' +WIN_PRC_TOOL_NAME = 'TOOL_NAME' +WIN_PRC_OFFL = 'OFFL' +WIN_PRC_OFFR = 'OFFR' + WIN_MAINGUIDE = 'MainGuide' WIN_STARTGUIDE = 'StartGuide' WIN_ENDGUIDE = 'EndGuide' @@ -210,6 +219,15 @@ WIN_SRF_END = 'EndSurface' WIN_BOTTOMRAIL = 'BottomRail' +WIN_PRC = 'Processings' +WIN_PRC_FEATURE_TYPE = 'FEATURE_TYPE' +WIN_PRC_TYPE = { + HOLE = 'Hole', + PROFILING = 'Profiling', + POCKET = 'Pocket', + CUT = 'Cut' +} + WIN_DOWEL = 'Dowel' WIN_DWL_TOPPERPSTART = 'TopPerpStart' WIN_DWL_TOPPERPEND = 'TopPerpEnd' diff --git a/Profiles/WinLib/WinCalculate.lua b/Profiles/WinLib/WinCalculate.lua index 34cdea1..039a3cf 100644 --- a/Profiles/WinLib/WinCalculate.lua +++ b/Profiles/WinLib/WinCalculate.lua @@ -28,6 +28,13 @@ function WinCalculate.SetCalcSolid( bValue) bCalcSolid = bValue end +--------------------------------------------------------------------- +-- funzione che copia la info di chiave sInfo da nSou a nDest +local function CopyInfo( nDest, nSou, sInfo) + local sVal = EgtGetInfo( nSou, sInfo) + EgtSetInfo( nDest, sInfo, sVal) +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 @@ -777,15 +784,12 @@ local function GetProfileCtrIn( nProfileType, nPrevOutlineId, nOutlineId, nPrevP end --------------------------------------------------------------------- -local function GetDeltaProfile( nProfileType, nPrevOutlineId, nOutlineId) - -- recupero il profilo dell'outline precedente - local nPrevProfileId = GetOutlineProfileId( nPrevOutlineId, nProfileType == WIN_PRF.SPLIT) - local sCtrIn = GetProfileCtrIn( nProfileType, nPrevOutlineId, nOutlineId, nPrevProfileId) +local function GetDeltaProfile( nProfileId, sCtrIn) local dCPDelta = 0 - local nSectionFrId = EgtGetFirstNameInGroup( nPrevProfileId, WIN_SECTIONFRAME) + local nSectionFrId = EgtGetFirstNameInGroup( nProfileId, WIN_SECTIONFRAME) local frSectionFrame = EgtFR( nSectionFrId) - local nCPId = EgtGetFirstNameInGroup( nPrevProfileId, sCtrIn) + local nCPId = EgtGetFirstNameInGroup( nProfileId, sCtrIn) local b3CP = EgtGetBBoxRef( nCPId, GDB_BB.STANDARD, frSectionFrame) if sCtrIn == WIN_CTRIN .. 1 then dCPDelta = abs( b3CP:getMin():getX()) @@ -812,15 +816,20 @@ local function CreateFrameGeo( nOutlineId, nPrevOutlineId, nNextOutlineId, nStar local nCurrCurveId = EgtCopy( nOutlineId, nGeoLayerId) EgtOffsetCurve( nCurrCurveId, dCurrOffset) EgtSetName( nCurrCurveId, WIN_GEO_OUT) + local nSemiProfileOut = EgtGetFirstNameInGroup( nCurrProfileId, WIN_OUT) or EgtGetFirstNameInGroup( nCurrProfileId, WIN_IN .. '1') + EgtSetInfo( nCurrCurveId, WIN_SEMI_PROFILE, nSemiProfileOut) -- cruva in local nCurrOffsetId = EgtCopy( nOutlineId, nGeoLayerId) EgtOffsetCurve( nCurrOffsetId, dCurrOffset - b3CurrProfileFrame:getDimX()) EgtInvertCurve( nCurrOffsetId) EgtSetName( nCurrOffsetId, WIN_GEO_IN) + local nSemiProfileIn = EgtGetFirstNameInGroup( nCurrProfileId, WIN_IN) or EgtGetFirstNameInGroup( nCurrProfileId, WIN_IN .. '2') + EgtSetInfo( nCurrOffsetId, WIN_SEMI_PROFILE, nSemiProfileIn) -- curva left local nPrevCurveId + local nPrevSemiProfile if nStartPartJointType == WIN_PART_JNT.ANGLED then -- calcolo la bisettrice local vtMedia = ( ( EgtSV( nOutlineId) - EgtEV( nPrevOutlineId)) / 2) @@ -832,16 +841,24 @@ local function CreateFrameGeo( nOutlineId, nPrevOutlineId, nNextOutlineId, nStar EgtInvertCurve( nPrevCurveId) else nPrevCurveId = EgtCopy( nPrevOutlineId, nGeoLayerId) + local nPrevProfileId = GetOutlineProfileId( nPrevOutlineId, nProfileType == WIN_PRF.SPLIT) if nStartPartJointType == WIN_PART_JNT.SHORT then - local dPrevCPDelta = GetDeltaProfile( nProfileType, nPrevOutlineId, nOutlineId) + local sCtrIn = GetProfileCtrIn( nProfileType, nPrevOutlineId, nOutlineId, nPrevProfileId) + local dPrevCPDelta = GetDeltaProfile( nPrevProfileId, sCtrIn) EgtOffsetCurve( nPrevCurveId, - dPrevCPDelta) EgtSetInfo( nGeoLayerId, WIN_STARTCPDELTA, dPrevCPDelta) + -- ricavo il semiprofilo associato + nPrevSemiProfile = EgtGetFirstNameInGroup( nPrevProfileId, sCtrIn) + else + nPrevSemiProfile = EgtGetFirstNameInGroup( nPrevProfileId, WIN_OUT) end end EgtSetName( nPrevCurveId, WIN_GEO_LEFT) + EgtSetInfo( nPrevCurveId, WIN_SEMI_PROFILE, nPrevSemiProfile) -- curva right local nNextCurveId + local nNextSemiProfile if nEndPartJointType == WIN_PART_JNT.ANGLED then -- calcolo la bisettrice local vtMedia = ( ( EgtSV( nNextOutlineId) - EgtEV( nOutlineId)) / 2) @@ -852,13 +869,20 @@ local function CreateFrameGeo( nOutlineId, nPrevOutlineId, nNextOutlineId, nStar nNextCurveId = EgtLinePVL( nGeoLayerId, EgtEP( nOutlineId), vtMedia, 3 * b3CurrProfileFrame:getDimX()) else nNextCurveId = EgtCopy( nNextOutlineId, nGeoLayerId) + local nNextProfileId = GetOutlineProfileId( nNextOutlineId, nProfileType == WIN_PRF.SPLIT) if nEndPartJointType == WIN_PART_JNT.SHORT then - local dNextCPDelta = GetDeltaProfile( nProfileType, nNextOutlineId, nOutlineId) + local sCtrIn = GetProfileCtrIn( nProfileType, nNextOutlineId, nOutlineId, nNextProfileId) + local dNextCPDelta = GetDeltaProfile( nNextProfileId, sCtrIn) EgtOffsetCurve( nNextCurveId, - dNextCPDelta) EgtSetInfo( nGeoLayerId, WIN_ENDCPDELTA, dNextCPDelta) + -- ricavo il semiprofilo associato + nNextSemiProfile = EgtGetFirstNameInGroup( nNextProfileId, sCtrIn) + else + nNextSemiProfile = EgtGetFirstNameInGroup( nNextProfileId, WIN_OUT) end end EgtSetName( nNextCurveId, WIN_GEO_RIGHT) + EgtSetInfo( nNextCurveId, WIN_SEMI_PROFILE, nNextSemiProfile) -- riordino le curve per eseguire correttamente il trim EgtRelocateGlob( nNextCurveId, nCurrCurveId, GDB_IN.AFTER) @@ -875,6 +899,42 @@ local function CreateFrameGeo( nOutlineId, nPrevOutlineId, nNextOutlineId, nStar return nCurrCurveId end +--------------------------------------------------------------------- +-- funzione che calcola le lavorazioni di profiling +local function CalcProfilingProcessings( nPartId, nGeoLayerId) + + -- creo gruppo delle lavorazioni + local nProcGrp = EgtGroup( nPartId) + EgtSetName( nProcGrp, WIN_PRC) + + -- recupero tutte le curve del geo + local vGeoCrvs = EgtGetAllInGroup( nGeoLayerId) + for i = 1, #vGeoCrvs do + -- copio curva + local nCrv = EgtCopyGlob( vGeoCrvs[i], nProcGrp) + + -- recupero il semiprofilo associato + local nSemiProfile = EgtGetInfo( nCrv, WIN_SEMI_PROFILE, 'i') + if nSemiProfile then + -- setto info di lavorazione + EgtSetInfo( nCrv, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.PROFILING) + -- recupero le info di lavorazione dal semiprofilo + CopyInfo( nCrv, nSemiProfile, WIN_PRC_PHASE) + CopyInfo( nCrv, nSemiProfile, WIN_PRC_PROFILE_TYPE) + local nTools = EgtGetInfo( nSemiProfile, WIN_PRC_NTOOLS , 'i') or 0 + EgtSetInfo( nCrv, WIN_PRC_NTOOLS, nTools) + for j = 1, nTools do + CopyInfo( nCrv, nSemiProfile, WIN_PRC_TOOL_NAME .. '_' .. tostring(j)) + CopyInfo( nCrv, nSemiProfile, WIN_PRC_OFFL .. '_' .. tostring(j)) + CopyInfo( nCrv, nSemiProfile, WIN_PRC_OFFR .. '_' .. tostring(j)) + end + else + -- se non ha semiprofilo associato è un taglio + EgtSetInfo( nCrv, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.CUT) + end + end +end + --------------------------------------------------------------------- -- funzione che calcola l'ingombro dei pezzi del telaio local function CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId, bBottomRail) @@ -927,6 +987,9 @@ local function CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId, bBottomRail) -- creo lati dell'outline local nGeoOutId = CreateFrameGeo( nOutlineId, nPrevOutlineId, nNextOutlineId, nStartPartJointType, nEndPartJointType, nProfileType, nGeoLayerId, bBottomRail) + + -- calcolo le lavorazioni associate ai profili + CalcProfilingProcessings( nPartId, nGeoLayerId) return nGeoOutId end @@ -1014,6 +1077,8 @@ local function AddStartDowels( nOutlineId, nPrevOutlineId, StartJointType, nMain EgtMove( nDowelId, dStart * vtRef) EgtModifyCurveExtrusion( nDowelId, vtRef) EgtModifyCurveThickness( nDowelId, dEnd - dStart) + -- setto info di lavorazione + EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) -- creo solido di estrusione local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, vtRef * ( dEnd - dStart + 1)) EgtMove( nDowelExtrusionId, - vtRef) @@ -1079,6 +1144,8 @@ local function AddStartDowels( nOutlineId, nPrevOutlineId, StartJointType, nMain EgtMove( nDowelId, vtRef * dStart) EgtModifyCurveExtrusion( nDowelId, vtRef) EgtModifyCurveThickness( nDowelId, dEnd - dStart) + -- setto info di lavorazione + EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) -- creo solido di estrusione local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, vtRef * ( dEnd - dStart + 1)) EgtMove( nDowelExtrusionId, - vtRef) @@ -1136,6 +1203,8 @@ local function AddEndDowels( nOutlineId, nEndOutlineId, EndJointType, nMainProfi EgtMove( nDowelId, - vtRef * dStart) EgtModifyCurveExtrusion( nDowelId, - vtRef) EgtModifyCurveThickness( nDowelId, dEnd - dStart) + -- setto info di lavorazione + EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) -- creo solido di estrusione local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, - vtRef * ( dEnd - dStart + 1)) EgtMove( nDowelExtrusionId, vtRef) @@ -1200,6 +1269,8 @@ local function AddEndDowels( nOutlineId, nEndOutlineId, EndJointType, nMainProfi EgtMove( nDowelId, - vtRef * dStart) EgtModifyCurveExtrusion( nDowelId, - vtRef) EgtModifyCurveThickness( nDowelId, dEnd - dStart) + -- setto info di lavorazione + EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) -- creo solido di estrusione local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, - vtRef * ( dEnd - dStart + 1)) EgtMove( nDowelExtrusionId, vtRef) @@ -1448,7 +1519,7 @@ local function CalSplitDowel( nSplitLayerId, nOutlineId, nProfileType, nPartId) local nMainExtrusionId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_MAIN) -- creo fori per spine su Split - local nDowelLayerId = EgtGetFirstNameInGroup( nPartId, WIN_DOWEL) + local nProcLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PRC) -- recupero profondita' d'inizio e fine local sStart = WIN_DWL_TOPPERPSTART @@ -1488,13 +1559,16 @@ local function CalSplitDowel( nSplitLayerId, nOutlineId, nProfileType, nPartId) if not dEnd then dEnd = EgtGetInfo( nOrigDowelId, WIN_DWL_TOPPERPEND, 'd') end - local nDowelId = EgtCopyGlob( nOrigDowelId, nDowelLayerId) + local nDowelId = EgtCopyGlob( nOrigDowelId, nProcLayerId) EgtSetColor( nDowelId, Color3d( 128, 128, 128)) -- posiziono il dowel e gli assegno estrusione e spessore EgtMove( nDowelId, vtDowelDir * dStart) EgtModifyCurveExtrusion( nDowelId, vtDowelDir) EgtModifyCurveThickness( nDowelId, dEnd - dStart) + -- setto info di lavorazione + EgtSetInfo( nDowelId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) + -- creo solido di estrusione local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nSolidLayerId, nDowelId, vtDowelDir * ( dEnd - dStart + 1)) EgtMove( nDowelExtrusionId, - vtDowelDir) @@ -1552,13 +1626,13 @@ end -- funzione che crea il solido del pezzo del telaio local function CalcFrameSolid( nPartId, nOutlineId, nGeoId, nOutlineLayerId, bBottomRail) - -- creo layer per solido, per profili di estrusione e per i fori per spine + -- creo layer per solido e per profili di estrusione local nSolidLayerId = EgtGroup( nPartId) EgtSetName( nSolidLayerId, WIN_SOLID) local nFrameProfileLayerId = EgtGroup( nPartId) EgtSetName( nFrameProfileLayerId, WIN_PROFILE) - local nDowelLayerId = EgtGroup( nPartId) - EgtSetName( nDowelLayerId, WIN_DOWEL) + -- recupero layer delle lavorazioni per i dowels + local nProcLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PRC) -- ricavo tipo di profilo local nProfileType = GetOutlineProfileType( nOutlineId, bBottomRail) @@ -1587,7 +1661,7 @@ local function CalcFrameSolid( nPartId, nOutlineId, nGeoId, nOutlineLayerId, bBo EgtSetName( nEndProfileId, WIN_PRF_END) -- creo solido dai profili - MakeSolidByExtrusion( nGeoId, nOutlineId, nMainProfileId, nStartProfileId, nEndProfileId, nProfileType, nSolidLayerId, nDowelLayerId) + MakeSolidByExtrusion( nGeoId, nOutlineId, nMainProfileId, nStartProfileId, nEndProfileId, nProfileType, nSolidLayerId, nProcLayerId) -- aggiungo dowels degli split AddSplitDowels( nOutlineId, nOutlineLayerId, nPartId, nProfileType) @@ -1655,14 +1729,14 @@ local function CreatePartFromOutline( nAreaLayerId, nOutlineId, bBottomRail) if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH or nAreaType == WIN_AREATYPES.SPLIT then -- disegno ingombro - local nGeoId = CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId, bBottomRail) + local nGeoId = CalcFrameGeo( nPartId, nOutlineId, nOutlineLayerId, bBottomRail) -- disegno solido if bCalcSolid then - CalcFrameSolid( nPartId, nOutlineId, nGeoId, nOutlineLayerId, bBottomRail) + CalcFrameSolid( nPartId, nOutlineId, nGeoId, nOutlineLayerId, bBottomRail) end elseif nAreaType == WIN_AREATYPES.FILL then -- disegno ingombro - local nGeoLayerId = CalcFillGeo( nPartId, nOutlineLayerId) + local nGeoLayerId = CalcFillGeo( nPartId, nOutlineLayerId) -- disegno solido if bCalcSolid then CalcFillSolid(nPartId, nOutlineLayerId, nGeoLayerId) @@ -2068,7 +2142,7 @@ local function SearchSash( nAreaId, SashList) local dFrameGapDeltaZ = EgtGetInfo( nFrameProfileTypeId, WIN_GAPDELTAZ, 'd') local nOutlineOutId = EgtCopy( nSouId, nOutlineOffsetLayerId) EgtSetName( nOutlineOutId, 'Frame') - EgtOffsetCurve( nOutlineOutId, - dGapDeltaOut) + EgtOffsetCurve( nOutlineOutId, - dGapDeltaOut) -- prendo la proiezione _, ptOrig = EgtPointCurveDist( ptOrig, nOutlineOutId) -- recupero DeltaZ2 @@ -2087,7 +2161,7 @@ local function SearchSash( nAreaId, SashList) 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) + table.insert( tFrame, nFT3Id) end end tSash.Frame = tFrame @@ -2230,7 +2304,7 @@ function WinCalculate.AddHardware( nFrameId) local nSashId = SashList[nSashIndex].nAreaId local nOutlineLayerId = EgtGetFirstNameInGroup( nSashId, WIN_OUTLINE) local vOutlineIds = EgtGetAllInGroup( nOutlineLayerId) - local nA = string.byte('A') + local nA = string.byte('A') local nSashPart = string.byte(sSashPart) local nOutlineIndex = #vOutlineIds - (nSashPart - nA) local nOutlineId = vOutlineIds[nOutlineIndex] @@ -2258,12 +2332,10 @@ function WinCalculate.AddHardware( nFrameId) frHdwFrame = EgtFR( nHdwFrameId) end local vMacro = EgtSplitString( sMacro, '_') - local nPartHdwLayerId = EgtGetFirstNameInGroup( nPartId, WIN_HARDWARE) - if not nPartHdwLayerId then - nPartHdwLayerId = EgtGroup( nPartId) - EgtSetName( nPartHdwLayerId, WIN_HARDWARE) - end - local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) + local nProcLayerId = EgtGetFirstNameInGroup( nPartId, WIN_PRC) + + -- recupero solido ( se non calcolato non vengono utilizzate) + local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID) or GDB_ID.NULL local nMainExtrusionId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_MAIN) local nOrigMainId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_ORIGMAIN) @@ -2273,31 +2345,37 @@ function WinCalculate.AddHardware( nFrameId) local dLength = tonumber( vMacro[2]) local dWidth = tonumber( vMacro[3]) local dHeight = tonumber( vMacro[4]) - local dExtra = 1 -- per non avere geometrie a filo nelle operazioni booleane - local nRSideId = EgtLine( nPartHdwLayerId, ptCenter - dLength / 2 * X_AX() - dExtra * Y_AX(), ptCenter + dLength / 2 * X_AX() - dExtra * Y_AX()) - local nTSideId = EgtLine( nPartHdwLayerId, EgtEP( nRSideId), EgtEP( nRSideId) + dExtra * Y_AX()) - local vtEnd = EgtEV( nRSideId) - vtEnd:rotate( Z_AX(), 90) - local nTChamferId = EgtArc2PV( nPartHdwLayerId, EgtEP( nTSideId), EgtEP( nTSideId) - dWidth * X_AX() + dWidth * Y_AX() , vtEnd) - local nLSideId = EgtLine( nPartHdwLayerId, EgtEP( nTChamferId), EgtEP( nTChamferId) - ( dLength - 2 * dWidth) * X_AX()) - vtEnd = EgtEV( nLSideId) - local nBChamferId = EgtArc2PV( nPartHdwLayerId, EgtEP( nLSideId), EgtEP( nLSideId) - dWidth * X_AX() - dWidth * Y_AX(), vtEnd) - local nBSideId = EgtLine( nPartHdwLayerId, EgtEP( nBChamferId), EgtSP( nRSideId)) - -- per lavorazione - local nMachPocketId = EgtCurveCompo( nPartHdwLayerId, { nTChamferId, nLSideId, nBChamferId}, false) - EgtModifyCurveExtrusion( nMachPocketId, Z_AX()) - EgtModifyCurveThickness( nMachPocketId, - dHeight) - EgtTransform( nMachPocketId, frHdwFrame) + local ptP1 = ptCenter + ( dLength / 2 - dWidth) * X_AX() + dWidth * Y_AX() + local ptP2 = ptCenter - ( dLength / 2 - dWidth) * X_AX() + dWidth * Y_AX() + local nSolidPocketOutlineId = EgtCurveCompoFromPoints( nProcLayerId, { ptP1, ptP2}) + EgtAddCurveCompoArcTg( nSolidPocketOutlineId, ptCenter - dLength / 2 * X_AX()) + EgtAddCurveCompoArcTg( nSolidPocketOutlineId, ptCenter + dLength / 2 * X_AX(), false) -- per solido - local nSolidPocketOutlineId = EgtCurveCompo( nPartHdwLayerId, { nRSideId, nTSideId, nTChamferId, nLSideId, nBChamferId, nBSideId}) - EgtMove( nSolidPocketOutlineId, dExtra * Z_AX()) - local nSolidPocketId = EgtSurfTmByRegionExtrusion( nPartHdwLayerId, nSolidPocketOutlineId, - ( dHeight + dExtra) * Z_AX()) + local nSolidPocketId + if 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 + EgtAddCurveCompoLineTg( nSolidPocketOutlineId, dExtra) + EgtAddCurveCompoLineTg( nSolidPocketOutlineId, dExtra, false) + EgtCloseCurveCompo( nSolidPocketOutlineId) + EgtMove( nSolidPocketOutlineId, dExtra * Z_AX()) + nSolidPocketId = EgtSurfTmByRegionExtrusion( nProcLayerId, nSolidPocketOutlineId, - ( dHeight + dExtra) * Z_AX()) + EgtTransform( nSolidPocketId, frHdwFrame) + EgtSurfTmSubtract( nMainExtrusionId, nSolidPocketId) + EgtInvertSurf( nSolidPocketId) + EgtSurfTmCut( nSolidPocketId, nOrigMainId, true, false) + else + -- costruisco asola esatta + EgtTransform( nSolidPocketOutlineId, frHdwFrame) + local nStmLat = EgtSurfTmByExtrusion( nProcLayerId, nSolidPocketOutlineId, - dHeight * Z_AX()) + EgtCloseCurveCompo( nSolidPocketOutlineId) + local nStmBase = EgtSurfTmByFlatContour( nProcLayerId, nSolidPocketOutlineId) + EgtMove( nStmBase, - dHeight * Z_AX()) + nSolidPocketId = EgtSurfTmBySewing( nProcLayerId, { nStmBase, nStmLat}) + end EgtErase( nSolidPocketOutlineId) - EgtTransform( nSolidPocketId, frHdwFrame) - EgtSurfTmSubtract( nMainExtrusionId, nSolidPocketId) - EgtInvertSurf( nSolidPocketId) - EgtSurfTmCut( nSolidPocketId, nOrigMainId, true, false) - EgtSetStatus( nSolidPocketId, GDB_ST.OFF) + EgtSetColor( nSolidPocketId, EgtStdColor( 'GRAY')) + EgtSetInfo( nSolidPocketId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.POCKET) elseif vMacro[1] == 'TASCA' then elseif vMacro[1] == 'VITE' then @@ -2311,30 +2389,34 @@ function WinCalculate.AddHardware( nFrameId) dDepth = 4 end local ptCenter = Point3d( dPosX, dPosY, dPosZ) - local nHoleId = EgtCircle( nPartHdwLayerId, ptCenter, dRadius) + local nHoleId = EgtCircle( nProcLayerId, ptCenter, dRadius) EgtModifyCurveExtrusion( nHoleId, Z_AX()) - EgtModifyCurveThickness( nHoleId, -dDepth) + EgtModifyCurveThickness( nHoleId, - dDepth) EgtTransform( nHoleId, frHdwFrame) + 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( nPartHdwLayerId, ptCenter, dRadius) + local dRadius = tonumber( sDiameter) / 2 + local nHoleId = EgtCircle( nProcLayerId, ptCenter, dRadius) -- per lavorazione EgtModifyCurveExtrusion( nHoleId, Z_AX()) local dDepth = 25.0 if #vMacro == 3 then dDepth = tonumber( vMacro[3]) end - EgtModifyCurveThickness( nHoleId, -dDepth) + EgtModifyCurveThickness( nHoleId, - dDepth) EgtTransform( nHoleId, frHdwFrame) + EgtSetColor( nHoleId, EgtStdColor( 'GRAY')) + EgtSetInfo( nHoleId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE) -- per solido - local nSolidHoleOutlineId = EgtCircle( nPartHdwLayerId, ptCenter + 0.01 * Z_AX(), dRadius) - local nSolidHoleId = EgtSurfTmByRegionExtrusion( nPartHdwLayerId, nSolidHoleOutlineId, -( dDepth + 0.01) * Z_AX()) - EgtErase( nSolidHoleOutlineId) - EgtTransform( nSolidHoleId, frHdwFrame) - EgtSurfTmSubtract( nMainExtrusionId, nSolidHoleId) - EgtSetStatus( nSolidHoleId, GDB_ST.OFF) + if bCalcSolid then + local nSolidHoleId = EgtSurfTmByRegionExtrusion( nProcLayerId, nHoleId, - ( dDepth + 1) * Z_AX()) + EgtMove( nSolidHoleId, Z_AX()) + EgtSurfTmSubtract( nMainExtrusionId, nSolidHoleId) + EgtErase( nSolidHoleId) + end end end