- solidi semplificati
- piccole correzioni varie.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -182,6 +182,7 @@ WIN_CTRINOFST = 'OfstCtrIn'
|
||||
WIN_OFST = 'Ofst'
|
||||
WIN_SECTIONFRAME = 'SectionFrame'
|
||||
WIN_MIXED_COMMON = 'Common'
|
||||
WIN_SIMPLIFIED = 'Simplified'
|
||||
|
||||
WIN_MINIZINKEN = 'MiniZinken'
|
||||
|
||||
|
||||
@@ -22,12 +22,17 @@ require( 'WinConst')
|
||||
|
||||
local s_dDowelTol = 1
|
||||
|
||||
local bCalcSolid = false
|
||||
local s_bCalcSolid = false
|
||||
function WinCalculate.GetCalcSolid()
|
||||
return bCalcSolid
|
||||
return s_bCalcSolid
|
||||
end
|
||||
function WinCalculate.SetCalcSolid( bValue)
|
||||
bCalcSolid = bValue
|
||||
s_bCalcSolid = bValue
|
||||
end
|
||||
|
||||
local s_bSimplSolid = false
|
||||
function WinCalculate.SetSimplifiedSolid( bValue)
|
||||
s_bSimplSolid = bValue
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -337,7 +342,7 @@ local function GetSplitType( nSplitLayerId)
|
||||
local nChildrenType = GetChildrenType( nSplitId)
|
||||
if nChildrenType == WIN_CHILDREN_TYPES.MIXED then
|
||||
nSplitType = WIN_SPLITTYPES.MIXED
|
||||
elseif nChildrenType == WIN_CHILDREN_TYPES.SASH then
|
||||
elseif nChildrenType == WIN_CHILDREN_TYPES.SASH or nChildrenType == WIN_CHILDREN_TYPES.NULL then
|
||||
nSplitType = WIN_SPLITTYPES.MULLION
|
||||
end
|
||||
end
|
||||
@@ -799,7 +804,9 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
|
||||
local b3FrameProfile = GetProfileLocalBox( nParentProfileId)
|
||||
-- calcolo offset perpendicolare e sulla z dell'anta
|
||||
local dOverlap = EgtGetInfo( nParentProfileId, WIN_FILLOVERLAP, 'd')
|
||||
local dFillPerpOffset = abs( b3FrameProfile:getMin():getX()) - dOverlap
|
||||
local bMixedSplit = ( EgtGetInfo( nParentOutlineId, WIN_PRF_CHANGE, 'b') or false) and EgtGetName( nParentOutlineId) == WIN_SPLIT
|
||||
local dDimRef = EgtIf( bMixedSplit, b3FrameProfile:getMax():getX(), b3FrameProfile:getMin():getX())
|
||||
local dFillPerpOffset = abs( dDimRef) - dOverlap
|
||||
local dFillZOffset = EgtGetInfo( nParentProfileId, WIN_FILLDELTA, 'd')
|
||||
|
||||
-- faccio offset e muovo in z
|
||||
@@ -1743,7 +1750,7 @@ local function CreateTrimSurf( nGeoId, nProfileId, dGeoWidth, nLayerId)
|
||||
local nOrigTrimProfileId = EgtGetInfo( nGeoId, WIN_SEMI_PROFILE, 'i')
|
||||
|
||||
-- 1) minizinken
|
||||
if not nOrigTrimProfileId then
|
||||
if not nOrigTrimProfileId then
|
||||
|
||||
local nGuideId = EgtCopy( nGeoId, nLayerId)
|
||||
EgtExtendCurveStartByLen( nGuideId, 4 * dGeoWidth)
|
||||
@@ -1759,7 +1766,7 @@ local function CreateTrimSurf( nGeoId, nProfileId, dGeoWidth, nLayerId)
|
||||
else
|
||||
-- recupero il controprofilo da estrudere
|
||||
local sTrimProfileName = EgtGetName( nOrigTrimProfileId)
|
||||
sTrimProfileName = WIN_OFST .. sTrimProfileName
|
||||
sTrimProfileName = EgtIf( s_bSimplSolid, WIN_SIMPLIFIED, '') .. WIN_OFST .. sTrimProfileName
|
||||
-- recupero la curva di outline associata alla curva di geo
|
||||
local nRefOutline = EgtGetInfo( nGeoId, WIN_REF_OUTLINE, 'i')
|
||||
-- calcolo la superficie di estrusione
|
||||
@@ -1775,7 +1782,8 @@ local function CreateMixedSplitTrimSurf( nMixedOutlineId, nProfileId, dExtraLen,
|
||||
-- estrudo il controprofilo di tipo sash
|
||||
local nPartId = EgtGetParent( EgtGetParent( nMixedOutlineId))
|
||||
local nOutlineId = EgtGetInfo( nPartId, WIN_REF_OUTLINE, 'i')
|
||||
local nTrimStmId = CreateProfileSurf( nOutlineId, nProfileId, WIN_OFST .. WIN_SASH .. WIN_CTRIN, dExtraLen, nLayerId)
|
||||
local sTrimProfile = EgtIf( s_bSimplSolid, WIN_SIMPLIFIED, '') .. WIN_OFST .. WIN_SASH .. WIN_CTRIN
|
||||
local nTrimStmId = CreateProfileSurf( nOutlineId, nProfileId, sTrimProfile, dExtraLen, nLayerId)
|
||||
|
||||
-- creo la superficie per il taglio a 45°
|
||||
local nIntersCrvId = EgtGetInfo( nMixedOutlineId, WIN_MIXED_INTERS_REF, 'i')
|
||||
@@ -1833,7 +1841,8 @@ local function CalcMixedFrameSolid( nOutlineId, nSolidLayerId, nProfileLayerId,
|
||||
local vMixedOutlines = EgtGetAllInGroup( nMixedOutlinesGrp)
|
||||
local vMainExtrusions = {}
|
||||
for i = 1, #vMixedOutlines do
|
||||
local nMainExtrusionId = CreateMainSurf( vMixedOutlines[i], 2 * dGeoWidth, nMainProfileId, EgtGetName( vMixedOutlines[i]) .. WIN_SECTION, nSolidLayerId)
|
||||
local sSection = EgtIf( s_bSimplSolid, WIN_SIMPLIFIED, '') .. EgtGetName( vMixedOutlines[i]) .. WIN_SECTION
|
||||
local nMainExtrusionId = CreateMainSurf( vMixedOutlines[i], 2 * dGeoWidth, nMainProfileId, sSection, nSolidLayerId)
|
||||
table.insert( vMainExtrusions, nMainExtrusionId)
|
||||
end
|
||||
|
||||
@@ -1904,7 +1913,8 @@ local function CalcMixedSplitSolid( nOutlineId, nSolidLayerId, nProfileLayerId,
|
||||
|
||||
-- a) creo il solido di estrusione principale
|
||||
local nMainProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN)
|
||||
local nMainExtrusionId = CreateMainSurf( nOutlineId, 2 * dGeoWidth, nMainProfileId, WIN_SECTION, nSolidLayerId)
|
||||
local sSection = EgtIf( s_bSimplSolid, WIN_SIMPLIFIED, '') .. WIN_SECTION
|
||||
local nMainExtrusionId = CreateMainSurf( nOutlineId, 2 * dGeoWidth, nMainProfileId, sSection, nSolidLayerId)
|
||||
-- creo una copia
|
||||
local nOrigMainExtrusionId = EgtCopy( nMainExtrusionId, nSolidLayerId)
|
||||
EgtSetName( nOrigMainExtrusionId, WIN_SRF_ORIGMAIN)
|
||||
@@ -1958,7 +1968,8 @@ local function CalcSolid( nPartId, nOutlineId)
|
||||
|
||||
-- a) creo il solido di estrusione principale
|
||||
local nMainProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN)
|
||||
local nMainExtrusionId = CreateMainSurf( nOutlineId, 2 * dGeoWidth, nMainProfileId, WIN_SECTION, nSolidLayerId)
|
||||
local sSection = EgtIf( s_bSimplSolid, WIN_SIMPLIFIED, '') .. WIN_SECTION
|
||||
local nMainExtrusionId = CreateMainSurf( nOutlineId, 2 * dGeoWidth, nMainProfileId, sSection, nSolidLayerId)
|
||||
-- creo una copia ( usata per calcolo ferramenta)
|
||||
local nOrigMainExtrusionId = EgtCopy( nMainExtrusionId, nSolidLayerId)
|
||||
EgtSetName( nOrigMainExtrusionId, WIN_SRF_ORIGMAIN)
|
||||
@@ -1987,7 +1998,6 @@ local function CalcSolid( nPartId, nOutlineId)
|
||||
-- eseguo intersezione per ottenere un solido unico
|
||||
EgtSurfTmIntersect( nMainExtrusionId, nTrimSurf)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
@@ -2095,7 +2105,16 @@ local function CreateDowel( nOrigDowelId, nLayerId, frOrig, frDest, vtDir, nTest
|
||||
-- eventuale aggiornamento del solido
|
||||
if nMainExtrusionId then
|
||||
-- creo solido di estrusione del dowel
|
||||
local nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nLayerId, nDowelId, vtDir * dLen)
|
||||
local nDowelExtrusionId
|
||||
if s_bSimplSolid then
|
||||
-- creo foro grossolano per velocizzare operazioni di subtract
|
||||
local nDowelApprox = EgtCopyGlob( nDowelId, nLayerId)
|
||||
EgtApproxCurve( nDowelApprox, GDB_CA.LINES, 0.2)
|
||||
nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nLayerId, nDowelApprox, vtDir * dLen)
|
||||
EgtErase( nDowelApprox)
|
||||
else
|
||||
nDowelExtrusionId = EgtSurfTmByRegionExtrusion( nLayerId, nDowelId, vtDir * dLen)
|
||||
end
|
||||
-- sottraggo il dowel al solido
|
||||
EgtSurfTmSubtract( nMainExtrusionId, nDowelExtrusionId)
|
||||
EgtErase( nDowelExtrusionId)
|
||||
@@ -2184,7 +2203,7 @@ local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail
|
||||
|
||||
-- recupero i solidi
|
||||
local nPrevSolidId, nSolidId, nPrevSolidLay, nSolidLay
|
||||
if bCalcSolid then
|
||||
if s_bCalcSolid then
|
||||
nSolidLay = EgtGetFirstNameInGroup( nPart, WIN_SOLID)
|
||||
nSolidId = EgtGetFirstNameInGroup( nSolidLay, WIN_SRF_MAIN)
|
||||
nPrevSolidLay = EgtGetFirstNameInGroup( nPrevPart, WIN_SOLID)
|
||||
@@ -2220,13 +2239,13 @@ local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail
|
||||
|
||||
-- superficie test per il posizionamento dei dowels : è la superficie in del pezzo full
|
||||
local nTestSurf
|
||||
if bCalcSolid then
|
||||
if not s_bCalcSolid or s_bSimplSolid then
|
||||
local sCtrIn = WIN_OFST .. GetProfileCtrIn( nOutlineId, nPrevOutlineId, nProfileId) -- controprofilo in del pezzo corrente
|
||||
nTestSurf = CreateProfileSurf( nOutlineId, nProfileId, sCtrIn, 100, nLayerId)
|
||||
else
|
||||
-- è la superficie che viene utilizzata per trimmare l'end del pezzo prev
|
||||
local nOrigSurf = EgtGetFirstNameInGroup( nPrevSolidLay, WIN_SRF_END)
|
||||
nTestSurf = EgtCopyGlob( nOrigSurf, nLayerId)
|
||||
else
|
||||
local sCtrIn = WIN_OFST .. GetProfileCtrIn( nOutlineId, nPrevOutlineId, nProfileId) -- controprofilo in del pezzo corrente
|
||||
nTestSurf = CreateProfileSurf( nOutlineId, nProfileId, sCtrIn, 100, nLayerId)
|
||||
end
|
||||
local nTestSurfInverted = EgtCopyGlob( nTestSurf, nLayerId)
|
||||
EgtInvertSurf( nTestSurfInverted)
|
||||
@@ -2235,11 +2254,11 @@ local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail
|
||||
local nTestSurf2
|
||||
if bSashOrFrame then
|
||||
-- se anta la superficie da cui non fuoriuscire è quella esterna del pezzo short, ovvero la superficie usata per trimmare lo start del pezzo corrente
|
||||
if bCalcSolid then
|
||||
if not s_bCalcSolid or s_bSimplSolid then
|
||||
nTestSurf2 = CreateProfileSurf( nPrevOutlineId, nPrevProfileId, WIN_OFST .. WIN_OUT, 100, nLayerId)
|
||||
else
|
||||
local nOrigSurf = EgtGetFirstNameInGroup( nSolidLay, WIN_SRF_START)
|
||||
nTestSurf2 = EgtCopyGlob( nOrigSurf, nLayerId)
|
||||
else
|
||||
nTestSurf2 = CreateProfileSurf( nPrevOutlineId, nPrevProfileId, WIN_OFST .. WIN_OUT, 100, nLayerId)
|
||||
end
|
||||
EgtInvertSurf( nTestSurf2)
|
||||
else
|
||||
@@ -2301,12 +2320,12 @@ local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail
|
||||
-- superficie test per il posizionamento dei dowels
|
||||
-- è il controprofilo in del pezzo full quindi è la stessa superficie che viene utilizzata per trimmare lo start del pezzo corrente
|
||||
local nTestSurf
|
||||
if bCalcSolid then
|
||||
local nOrigSurf = EgtGetFirstNameInGroup( nSolidLay, WIN_SRF_START)
|
||||
nTestSurf = EgtCopyGlob( nOrigSurf, nLayerId)
|
||||
else
|
||||
if not s_bCalcSolid or s_bSimplSolid then
|
||||
local sCtrIn = WIN_OFST .. GetProfileCtrIn( nPrevOutlineId, nOutlineId, nPrevProfileId) -- controprofilo del pezzo full
|
||||
nTestSurf = CreateProfileSurf( nPrevOutlineId, nPrevProfileId, sCtrIn, 100, nLayerId)
|
||||
else
|
||||
local nOrigSurf = EgtGetFirstNameInGroup( nSolidLay, WIN_SRF_START)
|
||||
nTestSurf = EgtCopyGlob( nOrigSurf, nLayerId)
|
||||
end
|
||||
local nTestSurfInverted = EgtCopyGlob( nTestSurf, nLayerId)
|
||||
EgtInvertSurf( nTestSurfInverted)
|
||||
@@ -2314,11 +2333,11 @@ local function CalcDowels( nOutlineId, nPrevOutlineId, bSashOrFrame, bBottomRail
|
||||
-- superficie test per la traslazione dei dowels
|
||||
local nTestSurf2
|
||||
if bSashOrFrame then
|
||||
if bCalcSolid then
|
||||
if not s_bCalcSolid or s_bSimplSolid then
|
||||
nTestSurf2 = CreateProfileSurf( nOutlineId, nProfileId, WIN_OFST .. WIN_OUT, 100, nLayerId)
|
||||
else
|
||||
local nOrigSurf = EgtGetFirstNameInGroup( nPrevSolidLay, WIN_SRF_END)
|
||||
nTestSurf2 = EgtCopyGlob( nOrigSurf, nLayerId)
|
||||
else
|
||||
nTestSurf2 = CreateProfileSurf( nOutlineId, nProfileId, WIN_OFST .. WIN_OUT, 100, nLayerId)
|
||||
end
|
||||
EgtInvertSurf( nTestSurf2)
|
||||
else
|
||||
@@ -2377,7 +2396,7 @@ local function CalcSplitDowels( nSplitId, vOutlines, bStartOrEnd)
|
||||
|
||||
-- recupero eventuale solido e superifici usate per il suo trim
|
||||
local nSplitSolidId, vTestSurf
|
||||
if bCalcSolid then
|
||||
if s_bCalcSolid then
|
||||
local nSplitSolidLayerId = EgtGetFirstNameInGroup( nSplitPart, WIN_SOLID)
|
||||
nSplitSolidId = EgtGetFirstNameInGroup( nSplitSolidLayerId, WIN_SRF_MAIN)
|
||||
vTestSurf = EgtGetNameInGroup( nSplitSolidLayerId, EgtIf( bStartOrEnd, WIN_SRF_START, WIN_SRF_END))
|
||||
@@ -2434,7 +2453,7 @@ local function CalcSplitDowels( nSplitId, vOutlines, bStartOrEnd)
|
||||
|
||||
-- recupero eventuale solido
|
||||
local nSolidId
|
||||
if bCalcSolid then
|
||||
if s_bCalcSolid then
|
||||
local nSolidLayerId = EgtGetFirstNameInGroup( nPartId, WIN_SOLID)
|
||||
nSolidId = EgtGetFirstNameInGroup( nSolidLayerId, WIN_SRF_MAIN)
|
||||
end
|
||||
@@ -2456,10 +2475,7 @@ local function CalcSplitDowels( nSplitId, vOutlines, bStartOrEnd)
|
||||
-- creo la superficie di test per il posizionamento dei dowels
|
||||
local nProfileId = EgtGetFirstNameInGroup( nProfileLayerId, WIN_PRF_MAIN)
|
||||
local nTestSurf
|
||||
if bCalcSolid then
|
||||
-- è la stessa superficie utilizzata per il trim del solido
|
||||
nTestSurf = EgtCopyGlob( vTestSurf[i], nSplitLayerId)
|
||||
else
|
||||
if not s_bCalcSolid or s_bSimplSolid then
|
||||
local sCtr
|
||||
local bChangeProfile = EgtGetInfo( nSplitId, WIN_PRF_CHANGE, 'b') or false
|
||||
if bChangeProfile then
|
||||
@@ -2468,6 +2484,9 @@ local function CalcSplitDowels( nSplitId, vOutlines, bStartOrEnd)
|
||||
sCtr = WIN_OFST .. GetProfileCtrIn( nOutlineId, nSplitId, nProfileId)
|
||||
end
|
||||
nTestSurf = CreateProfileSurf( nOutlineId, nProfileId, sCtr, 100, nLayerId)
|
||||
else
|
||||
-- è la stessa superficie utilizzata per il trim del solido
|
||||
nTestSurf = EgtCopyGlob( vTestSurf[i], nSplitLayerId)
|
||||
end
|
||||
local nTestSurfInverted = EgtCopyGlob( nTestSurf, nSplitLayerId)
|
||||
EgtInvertSurf( nTestSurfInverted)
|
||||
@@ -2575,9 +2594,10 @@ end
|
||||
-- funzione che restitutisce lo Strip piu' vicino
|
||||
-- ( analoga a GetProfileCtrIn)
|
||||
local function GetStripNearestToOutline( nPrevProfileId, nPrevOutlineId, nOutlineId)
|
||||
local nStripId = EgtGetFirstNameInGroup( nPrevProfileId, WIN_STRIP)
|
||||
local sStripName = WIN_STRIP
|
||||
|
||||
-- gestione particolare del caso di profilo di split
|
||||
if not nStripId then
|
||||
if not EgtGetFirstNameInGroup( nPrevProfileId, sStripName) then
|
||||
-- recupero la curva di base outline da cui deriva il precedente
|
||||
local nPrevSouId = EgtGetInfo( nPrevOutlineId, WIN_COPY, 'i')
|
||||
local sPrevSouName
|
||||
@@ -2589,12 +2609,16 @@ local function GetStripNearestToOutline( nPrevProfileId, nPrevOutlineId, nOutlin
|
||||
-- verifico da quale lato si trova la curva per decidere quale controprofilo considerare
|
||||
local _, _, nSide = EgtPointCurveDistSide( EgtMP( nOutlineId), nPrevSouId, Z_AX())
|
||||
if nSide == 1 then
|
||||
nStripId = EgtGetFirstNameInGroup( nPrevProfileId, WIN_STRIP .. '1') -- dx
|
||||
sStripName = WIN_STRIP .. '1' -- dx
|
||||
else
|
||||
nStripId = EgtGetFirstNameInGroup( nPrevProfileId, WIN_STRIP .. '2') -- sx
|
||||
sStripName = WIN_STRIP .. '2' -- sx
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if s_bSimplSolid then
|
||||
sStripName = WIN_SIMPLIFIED .. sStripName
|
||||
end
|
||||
local nStripId = EgtGetFirstNameInGroup( nPrevProfileId, sStripName)
|
||||
return nStripId
|
||||
end
|
||||
|
||||
@@ -2777,7 +2801,7 @@ local function CreatePartFromOutline( nAreaLayerId, nOutlineId, nOutlineCrvNbr,
|
||||
-- calcolo le lavorazioni associate ai profili
|
||||
CalcProfilingProcessings( nPartId, nOutlineId)
|
||||
-- disegno solido
|
||||
if bCalcSolid then
|
||||
if s_bCalcSolid then
|
||||
CalcSolid( nPartId, nOutlineId)
|
||||
end
|
||||
|
||||
@@ -2798,7 +2822,7 @@ local function CreatePartFromOutline( nAreaLayerId, nOutlineId, nOutlineCrvNbr,
|
||||
-- disegno ingombro
|
||||
local nGeoLayerId = CalcFillGeo( nPartId, nOutlineLayerId)
|
||||
-- disegno solido
|
||||
if bCalcSolid then
|
||||
if s_bCalcSolid then
|
||||
CalcFillSolid( nPartId, nOutlineLayerId, nGeoLayerId)
|
||||
end
|
||||
end
|
||||
@@ -2853,7 +2877,7 @@ local function CalculateAreaParts( nAreaId)
|
||||
end
|
||||
end
|
||||
elseif nAreaType ~= WIN_AREATYPES.FILL then
|
||||
if bCalcSolid then
|
||||
if s_bCalcSolid then
|
||||
--- verifico se area successiva e' un fill
|
||||
local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREAASTERISK)
|
||||
local nChildAreaType = EgtGetInfo( nChildAreaId or GDB_ID.NULL, WIN_AREATYPE, "i")
|
||||
@@ -3343,7 +3367,7 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest)
|
||||
EgtAddCurveCompoArcTg( nSolidPocketOutlineId, ptCenter + dLength / 2 * X_AX(), false)
|
||||
-- per solido
|
||||
local nSolidPocketId
|
||||
if bCalcSolid then
|
||||
if s_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)
|
||||
@@ -3401,7 +3425,7 @@ function WinCalculate.AddHardwareForSash( nFrameId, bOnlyRequest)
|
||||
EgtSetColor( nHoleId, EgtStdColor( 'GRAY'))
|
||||
EgtSetInfo( nHoleId, WIN_PRC_FEATURE_TYPE, WIN_PRC_TYPE.HOLE)
|
||||
-- per solido
|
||||
if bCalcSolid then
|
||||
if s_bCalcSolid then
|
||||
local nSolidHoleId = EgtSurfTmByRegionExtrusion( nProcLayerId, nHoleId, - ( dDepth + 1) * Z_AX())
|
||||
EgtMove( nSolidHoleId, Z_AX())
|
||||
EgtTransform( nSolidHoleId, frHdwFrame)
|
||||
|
||||
Reference in New Issue
Block a user