- disattivata l'impostazione per l'esecuzione nel CAM5 per il CreateSolid
- gestione dell'import di piani cucina con un loop interno - gestione della creazione di un fondello con un pezzo unico o con un pezzo per lato - correzioni al calcolo del draft angle, creazione del pezzo a partire da misure e angoli e calcolo delle misure del pezzo tenendo conto dei vicini.
This commit is contained in:
@@ -897,7 +897,7 @@ local function Draw(bPreview)
|
||||
SideAngSolid( tbId_InLoop[i], true)
|
||||
end
|
||||
|
||||
CreateSolid()
|
||||
CreateSolid()
|
||||
|
||||
|
||||
---- POCKET
|
||||
@@ -916,7 +916,7 @@ end
|
||||
--
|
||||
|
||||
|
||||
--per uso nell' |omagOFFICE|
|
||||
--per uso nell' |omagOFFICE| ( bAutoRun deve essere settato a false)
|
||||
function SLD.Main()
|
||||
IdFP = SLD.CurrId
|
||||
ClearCurrIdSOLID()
|
||||
@@ -931,20 +931,20 @@ end
|
||||
GetThickness()
|
||||
Draw( true)
|
||||
EgtSetStatus( IdFP, GDB_ST.OFF)
|
||||
EgtDraw()
|
||||
--EgtDraw()
|
||||
SLD.ERR = 0
|
||||
end
|
||||
|
||||
--per uso nell' |omagOFFICE|
|
||||
|
||||
--per uso nel |CAM5| (bAutoRun da settare a true)
|
||||
bAutoRun = true -- debug
|
||||
--bAutoRun = true
|
||||
if bAutoRun then
|
||||
ClearCurrIdSOLID()
|
||||
RTh = SLD.THICK
|
||||
IdFP = EgtGetFirstPart()
|
||||
local sName = ""
|
||||
--IdFP = 49389
|
||||
--IdFP = 204
|
||||
while IdFP ~= nil and sName ~= "SOLID" do
|
||||
-- procedo a costruire il solido solo se sono in un part con un OutLoop
|
||||
local nLay = EgtGetFirstNameInGroup(IdFP, "OutLoop")
|
||||
@@ -958,7 +958,7 @@ if bAutoRun then
|
||||
--break
|
||||
end
|
||||
--EgtSaveFile('c:\\EgtData\\OmagOFFICE\\Temp\\buche_sottili_SOLID.nge')
|
||||
EgtDraw()
|
||||
--EgtDraw()
|
||||
--SLD.ERR = 0
|
||||
end
|
||||
-----per uso nel |CAM5|
|
||||
|
||||
+46
-41
@@ -64,20 +64,14 @@ end
|
||||
--
|
||||
|
||||
-- ASSEGNO Info per conoscere le direzioni dei lati
|
||||
function TOOL.SetMachiningInfo(Layer, bInLoop)
|
||||
-- if not bInLoop then return end
|
||||
if EgtIsLayer( Layer) then
|
||||
local LayerName = EgtGetName( Layer)
|
||||
-- verifico che sia di tipo In o Out, altrimenti ricerco nel Part il layer
|
||||
if not LayerName == 'OutLoop' or not LayerName == 'InLoop' then
|
||||
Layer = EgtGetFirstInGroup( Layer)
|
||||
CMP.ERR = 2
|
||||
CMP.MSG = CMP.MSG.." In SetMachiningInfo il Layer non è di tipo 'OutLoop' o 'InLoop'."
|
||||
end
|
||||
else
|
||||
CMP.ERR = 3
|
||||
CMP.MSG = CMP.MSG.." In SetMachiningInfo il Layer non è di tipo 'OutLoop' o 'InLoop'."
|
||||
end
|
||||
function TOOL.SetMachiningInfo(Layer)
|
||||
local LayerName = EgtGetName( Layer)
|
||||
-- verifico che sia di tipo In o Out, altrimenti ricerco nel Part il layer
|
||||
if not LayerName == 'OutLoop' or not LayerName == 'InLoop' then
|
||||
Layer = EgtGetFirstInGroup( Layer)
|
||||
CMP.ERR = 2
|
||||
CMP.MSG = CMP.MSG.." In SetMachiningInfo il Layer non è di tipo 'OutLoop' o 'InLoop'."
|
||||
end
|
||||
local nId = EgtGetFirstInGroup(Layer)
|
||||
local nPrevId = EgtGetLastInGroup(Layer)
|
||||
local nNextId = EgtGetNext(nId)
|
||||
@@ -86,16 +80,16 @@ function TOOL.SetMachiningInfo(Layer, bInLoop)
|
||||
if nEdges == 1 then
|
||||
EgtSetInfo(nId, 'PrevAng', 0)
|
||||
EgtSetInfo(nId, 'NextAng', 0)
|
||||
return
|
||||
return
|
||||
end
|
||||
for i = 1, nEdges do
|
||||
-- recupero i dati
|
||||
local vtCurrS = EgtSV(nId, GDB_RT.GLOB)
|
||||
local vtPrevE = EgtEV(nPrevId, GDB_RT.GLOB)
|
||||
local vtCurrE = EgtEV(nId, GDB_RT.GLOB)
|
||||
local vtCurrE = EgtEV(nId, GDB_RT.GLOB)
|
||||
local vtNextS = EgtSV(nNextId, GDB_RT.GLOB)
|
||||
local vtAx = Z_AX()
|
||||
if bInLoop then vtAx=-vtAx end
|
||||
local vtAx = Z_AX()
|
||||
--if bInLoop then vtAx=-vtAx end
|
||||
local NextAng = GetRotation( vtCurrE, vtNextS, vtAx)
|
||||
local PrevAng = GetRotation( vtPrevE, vtCurrS, vtAx)
|
||||
-- scrivo le info
|
||||
@@ -152,7 +146,7 @@ function TOOL.ExplodeAndNameEdges( IdLoop, bInLoop)
|
||||
nEdge = EgtGetNext(nEdge)
|
||||
end
|
||||
-- Ricavo info direzioni
|
||||
TOOL.SetMachiningInfo(nLay,bInLoop)
|
||||
TOOL.SetMachiningInfo(nLay)
|
||||
return tbIdLoop
|
||||
end
|
||||
--
|
||||
@@ -184,12 +178,14 @@ function TOOL.CreatePart(tbLayer, sName, tbIdEntCrv, dTh, bInLoop)
|
||||
-- Nel Layer Region definisco la regione piana
|
||||
local IdReg = EgtSurfFlatRegion(tbLayer['Region'],IdLoop)
|
||||
-- Se InLoop allora faccio la sottrazione con la regione OutRegion
|
||||
--local bInvertCurve = false
|
||||
if bInLoop then
|
||||
local IdOutRegion = EgtGetPrev(IdReg)
|
||||
local vtNorm1 = EgtSurfFrNormVersor(IdOutRegion)
|
||||
local vtNorm2 = EgtSurfFrNormVersor(IdReg)
|
||||
if AreOppositeVectorApprox( vtNorm1, vtNorm2) then
|
||||
EgtInvertSurf(IdReg)
|
||||
--bInvertCurve = true
|
||||
end
|
||||
if not EgtSurfFrSubtract( IdOutRegion,IdReg) then
|
||||
CMP.ERR = 5
|
||||
@@ -203,11 +199,14 @@ function TOOL.CreatePart(tbLayer, sName, tbIdEntCrv, dTh, bInLoop)
|
||||
|
||||
-- Se sono InLoop non devo settare
|
||||
if bInLoop then
|
||||
for i = 1, #tbIdEntCrv do
|
||||
EgtInvertCurve(tbIdEntCrv[i])
|
||||
end
|
||||
--if bInvertCurve then
|
||||
-- for i = 1, #tbIdEntCrv do
|
||||
-- EgtInvertCurve(tbIdEntCrv[i])
|
||||
-- end
|
||||
--end
|
||||
return
|
||||
end
|
||||
|
||||
-- definisco spessore pezzo
|
||||
if dTh then EgtSetInfo(IdPart, 'Th', dTh) end
|
||||
-- INFO NECESSARIA
|
||||
@@ -284,7 +283,7 @@ function TOOL.CreatePointReference( sNamePart, sNameLayer,sNameEdge, sNameRef, n
|
||||
if not IdEnt then
|
||||
CMP.ERR=6
|
||||
CMP.MSG= CMP.MSG..' Non esiste il lato '..sNameEdge..' nel layer '..sNameLayer..' del part '..sNamePart
|
||||
return
|
||||
return
|
||||
end
|
||||
local pt = EgtSP(IdEnt, GDB_RT.GLOB)
|
||||
if nTypePt == 1 then
|
||||
@@ -424,21 +423,24 @@ end
|
||||
function CalcDraftAngle( vtDir1, vtDir2, dPairAng1, dPairAng2, dAngBetween)
|
||||
-- vengono restituiti il SideAng ( calcolato dall'angolo in 3d), i due nuovi angoli di forma per i due pezzi
|
||||
-- dBeta1 è riferito al pezzo 1 e dBeta2 è riferito al pezzo 2
|
||||
local dAngTilt1 = dPairAng1 - 90
|
||||
local dAngTilt2 = dPairAng2 - 90
|
||||
local vtN1 = Vector3d({0,100,0})
|
||||
local vtN2 = Vector3d({0,100,0})
|
||||
vtN1:rotate(X_AX(),dAngTilt1)
|
||||
vtN2:rotate(X_AX(), dAngTilt2)
|
||||
vtN2:rotate(Z_AX(), dAngBetween)
|
||||
local dAngTilt1 = 180 - dPairAng1
|
||||
local dAngTilt2 = 180 - dPairAng2
|
||||
local vtN1 = Vector3d({0,0,100})
|
||||
local vtN2 = Vector3d({0,0,100})
|
||||
vtN1:rotate(vtDir1, dAngTilt1)
|
||||
vtN2:rotate(vtDir2, dAngTilt2)
|
||||
--vtN2:rotate(Z_AX(), dAngBetween)
|
||||
local vtPerp = vtN1 ^ vtN2
|
||||
local vtInters1 = vtN1 ^ vtPerp
|
||||
local vtInters2 = vtPerp ^ vtN2
|
||||
--local dAng3d = GetRotation(vtInters1, vtInters2, vtPerp)
|
||||
local dAng3d = GetAngle(vtInters1, vtInters2)
|
||||
local dBeta1 = GetAngle( vtDir1, vtPerp)
|
||||
if (dPairAng2 > 90 and dBeta1 > 90) or (dPairAng2 < 90 and dBeta1 < 90) then dBeta1 = 180 - dBeta1 end
|
||||
local dBeta2 = GetAngle( vtDir2, vtPerp)
|
||||
local dSideAng = (180 - dAng3d) / 2
|
||||
if (dPairAng1 > 90 and dBeta2 > 90) or (dPairAng1 < 90 and dBeta2 < 90) then dBeta2 = 180 - dBeta2 end
|
||||
local dSideAng = 0
|
||||
dSideAng = (180 - dAng3d) / 2
|
||||
return dSideAng, dBeta1, dBeta2
|
||||
end
|
||||
|
||||
@@ -519,7 +521,7 @@ function TOOL.CreateAdjustedPart( nLayOutloop, dLen, dH, dBeta1, dBeta2)
|
||||
-- dLen è la lunghezza del lato su cui si va ad agganciare il pezzo che sto creando, quindi è un dato fisso
|
||||
-- bisogna calcolare gli altri tre lati del quadrilatero
|
||||
-- dProj1 dProj2
|
||||
-- __|_____________________________|__
|
||||
-- __|__ _______________________ __|__
|
||||
-- \ / |
|
||||
-- \ beta1 beta2 / |dH
|
||||
-- \ /___________dLen__________\ / |
|
||||
@@ -538,12 +540,12 @@ function TOOL.CreateAdjustedPart( nLayOutloop, dLen, dH, dBeta1, dBeta2)
|
||||
local pt3 = Point3d(dLen + dProj2,dH,0)
|
||||
local nLine2 = EgtLine( nLayOutloop, pt2, pt3)
|
||||
EgtSetName(nLine2, "A2")
|
||||
local pt4 = Point3d( dProj1,dH,0)
|
||||
local pt4 = Point3d( -dProj1,dH,0)
|
||||
local nLine3 = EgtLine( nLayOutloop, pt3, pt4)
|
||||
EgtSetName(nLine3, "A3")
|
||||
local nLine4 = EgtLine( nLayOutloop, pt4, pt1)
|
||||
EgtSetName(nLine4, "A4")
|
||||
TOOL.SetMachiningInfo(nLayOutloop, false)
|
||||
TOOL.SetMachiningInfo(nLayOutloop)
|
||||
return {nLine1, nLine2, nLine3, nLine4}
|
||||
end
|
||||
|
||||
@@ -558,17 +560,18 @@ function TOOL.CreateCircularHole(nPart, ptCenter, dDiam)
|
||||
local nInLoopLay = EgtGroup(nPart)
|
||||
EgtSetName(nInLoopLay, 'InLoop')
|
||||
local HoleId = EgtCircle( nInLoopLay, ptCenter, dDiam, GDB_RT.GLOB)
|
||||
TOOL.SetMachiningInfo(nInLoopLay, true)
|
||||
TOOL.SetMachiningInfo(nInLoopLay)
|
||||
TOOL.CreatePart(TOOL.FindLayers(nPart),nil,{HoleId},nil,true)
|
||||
end
|
||||
|
||||
|
||||
function TOOL.CreateParetina(i, tbIdLoopTC, tbInfo)
|
||||
function TOOL.CreateParetina(i, tbIdLoopTC, tbInfo, dPairAngCorr)
|
||||
if dPairAngCorr == nil then dPairAngCorr = 0 end
|
||||
local nPrev = i > 1 and i - 1 or #tbIdLoopTC
|
||||
local nNext = i < #tbIdLoopTC and i + 1 or 1
|
||||
local dPairAngPrev = EgtGetInfo(tbInfo.nPrev, 'PairAng', 'd') or 0
|
||||
local dPairAngNext = EgtGetInfo(tbInfo.nNext, 'PairAng', 'd') or 0
|
||||
local dPairAng = EgtGetInfo(tbInfo.nId, 'PairAng', 'd') or 0
|
||||
local dPairAngPrev = (EgtGetInfo(tbInfo.nPrev, 'PairAng', 'd') or 0) + dPairAngCorr
|
||||
local dPairAngNext = (EgtGetInfo(tbInfo.nNext, 'PairAng', 'd') or 0) + dPairAngCorr
|
||||
local dPairAng = (EgtGetInfo(tbInfo.nId, 'PairAng', 'd') or 0) + dPairAngCorr
|
||||
local vtDirCurr = EgtSV( tbIdLoopTC[i], GDB_RT.GLOB)
|
||||
local vtDirNext = EgtSV( tbIdLoopTC[nNext], GDB_RT.GLOB)
|
||||
local vtDirPrev = EgtEV( tbIdLoopTC[nPrev], GDB_RT.GLOB)
|
||||
@@ -585,7 +588,8 @@ function TOOL.CreateParetina(i, tbIdLoopTC, tbInfo)
|
||||
if bSameSide then
|
||||
if tbInfo.nJunctionType == 3 then
|
||||
local dSideAng_4, _, dBeta_DX = CalcDraftAngle( vtDirPrev, vtDirCurr, dPairAngPrev, dPairAng, PAng)
|
||||
tbInfo.dAngBR = 180 - dBeta_DX
|
||||
--tbInfo.dAngBR = 180 - dBeta_DX
|
||||
tbInfo.dAngBR = dBeta_DX
|
||||
if tbInfo.bOnLoop then dSideAng_4 = dSideAng_4 * (-1) end
|
||||
if PAng < 0 then dSideAng_4 = dSideAng_4 * (-1) end
|
||||
tbInfo.dSideAngR = dSideAng_4
|
||||
@@ -618,7 +622,8 @@ function TOOL.CreateParetina(i, tbIdLoopTC, tbInfo)
|
||||
if bSameSide then
|
||||
if tbInfo.nJunctionType == 3 then
|
||||
local dSideAng_2, dBeta_SX, __ = CalcDraftAngle( vtDirCurr, vtDirNext, dPairAng, dPairAngNext, NAng)
|
||||
tbInfo.dAngBL = 180 - dBeta_SX
|
||||
-- tbInfo.dAngBL = 180 - dBeta_SX
|
||||
tbInfo.dAngBL = dBeta_SX
|
||||
if tbInfo.bOnLoop then dSideAng_2 = dSideAng_2 * (-1) end
|
||||
if NAng < 0 then dSideAng_2 = dSideAng_2 * (-1) end
|
||||
tbInfo.dSideAngL = dSideAng_2
|
||||
|
||||
+25
-13
@@ -138,9 +138,10 @@ function ImportLoop( PartId, tbLayer, sNameFileNGE)
|
||||
EgtSetInfo(tbIdLoop[6],'AF',2)
|
||||
EgtSetInfo(tbIdLoop[7],'AF',1)
|
||||
|
||||
-- controllo la presenza di eventuali inloop
|
||||
-- controllo la presenza di eventuali inloop ( che mi aspetto essere CCW)
|
||||
local IdInLoop = EgtGetFirstInGroup(FstLayerInLstPart)
|
||||
if IdInLoop then
|
||||
EgtInvertCurve(IdInLoop)
|
||||
local InLoopLay = EgtGroup(PartId)
|
||||
EgtSetName(InLoopLay, 'InLoop')
|
||||
EgtRelocateGlob( IdInLoop, InLoopLay)
|
||||
@@ -196,17 +197,20 @@ local function CreateBottomPart( tbIdLoop, sNamePartDest, nParent)
|
||||
WriteDataToChildPart(nParent, Pz_Bottom, nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh)
|
||||
end
|
||||
|
||||
local function CreateSplitBottomPart( tbIdLoop, nParent)
|
||||
local function CreateSplitBottomPart( tbIdLoop, nParent, dOffset)
|
||||
-- creo il fondo diviso in un numero di pezzi pari ai lati del loop passato
|
||||
local nLay = EgtGetParent(tbIdLoop[1])
|
||||
local nLoop = EgtCurveCompoByChain(nLay, tbIdLoop, EgtSP(tbIdLoop[1], GDB_RT.GLOB), false)
|
||||
local nAuxLay = EgtGroup( nLay)
|
||||
EgtSetName(nAuxLay, 'OutLoop')
|
||||
local nLoop = EgtCurveCompoByChain(nAuxLay, tbIdLoop, EgtSP(tbIdLoop[1], GDB_RT.GLOB), false)
|
||||
EgtOffsetCurve(nLoop, -dOffset, GDB_OT.EXTEND)
|
||||
local ptCenter = EgtGP(nLoop, GDB_RT.GLOB)
|
||||
EgtErase(nLoop)
|
||||
local tbLoopOff = TOOL.ExplodeAndNameEdges( nLoop, false)
|
||||
local nPrev = 0
|
||||
local nFirst = 0
|
||||
local tbSplitBottom = {}
|
||||
-- creo i part con tutte le info
|
||||
for i = 1, #tbIdLoop do
|
||||
for i = 1, #tbLoopOff do
|
||||
local tbPart = {}
|
||||
local Pz_Bottom = TOOL.CreatePartLayer('BottomA'..tostring(i), sUNICode)
|
||||
if i == 1 then nFirst = Pz_Bottom end
|
||||
@@ -220,7 +224,8 @@ local function CreateSplitBottomPart( tbIdLoop, nParent)
|
||||
tbPart.dPairAng = 90 - CMP.dSlopeAng
|
||||
EgtSetInfo(Pz_Bottom, 'PairAng', tbPart.dPairAng)
|
||||
tbPart.nJunctionType = 3
|
||||
tbPart.dH = EgtPointCurveDist( ptCenter, tbIdLoop[i], GDB_RT.GLOB)
|
||||
tbPart.bOnLoop = true
|
||||
tbPart.dH = EgtPointCurveDist( ptCenter, tbLoopOff[i], GDB_RT.GLOB) - 15
|
||||
tbPart.nPrev = nPrev
|
||||
if i > 1 then tbSplitBottom[nPrev].nNext = Pz_Bottom end
|
||||
tbSplitBottom[Pz_Bottom] = tbPart
|
||||
@@ -233,20 +238,27 @@ local function CreateSplitBottomPart( tbIdLoop, nParent)
|
||||
for nPart, tbPart in pairs(tbSplitBottom) do
|
||||
local tbLayerBottom = TOOL.FindLayers(nPart)
|
||||
local bInLoop = false
|
||||
TOOL.CreateParetina( tbPart.nEdge, tbIdLoop, tbPart)
|
||||
TOOL.CreateParetina( tbPart.nEdge, tbLoopOff, tbPart, 90)
|
||||
-- tbPart.dLen = 300 + CMP.SWater * 2
|
||||
-- tbPart.dAngBL = 46
|
||||
-- tbPart.dAngBR = 46
|
||||
local tbPartLoop = TOOL.CreateAdjustedPart( tbLayerBottom['OutLoop'],tbPart.dLen, tbPart.dH, tbPart.dAngBL, tbPart.dAngBR)
|
||||
TOOL.CreatePart(tbLayerBottom,tbPart.sName,tbPartLoop,tbPart.dTh,bInLoop)
|
||||
TOOL.SetMachiningInfo(tbLayerBottom['OutLoop'], false)
|
||||
-- tbPart.dSideAngL = 8
|
||||
-- tbPart.dSideAngR = 8
|
||||
if tbPart.dSideAngL then TOOL.SetSideAng(tbLayerBottom['OutLoop'], 'A2', tbPart.dSideAngL) end
|
||||
if tbPart.dSideAngR then TOOL.SetSideAng(tbLayerBottom['OutLoop'], 'A4', tbPart.dSideAngR) end
|
||||
-- creo i riferimenti e salvo i parametri del part
|
||||
local sNamePartDest = 'InPartA'..tostring(tbPart.nEdge)
|
||||
TOOL.CreateReference( sUNICode, sNamePartDest, 'OutLoop', 'A1', 'R1', tbPart.dTh, tbPart.sDestRefOff)
|
||||
TOOL.CreateReference(sUNICode, tbPart.sName, 'OutLoop', 'A3', 'R3', 0, tbPart.sRefOff)
|
||||
TOOL.SetPairInfo(sUNICode, tbPart.sName, 'R3', sNamePartDest, 'R1', -1, tbPart.dPairAng, 4)
|
||||
TOOL.CreateReference(sUNICode, tbPart.sName, 'OutLoop', 'A1', 'R1', 0, tbPart.sRefOff)
|
||||
TOOL.SetPairInfo(sUNICode, tbPart.sName, 'R1', sNamePartDest, 'R1', -1, tbPart.dPairAng, 4)
|
||||
WriteDataToChildPart(nParent, nPart, nEdge,tbPart.dLen,tbPart.dAngBR, tbPart.dAngBL, tbPart.dH, tbPart.dTh)
|
||||
end
|
||||
|
||||
EgtErase(nAuxLay)
|
||||
|
||||
return tbSplitBottom
|
||||
end
|
||||
|
||||
@@ -444,10 +456,10 @@ function CMP_Draw(bPreview)
|
||||
end
|
||||
|
||||
-- -- creo il fondo
|
||||
CreateBottomPart( tbIdInLoopTC, 'InPartA4')
|
||||
--CreateSplitBottomPart( tbIdInLoopTC, Pz_Top)
|
||||
--CreateBottomPart( tbIdInLoopTC, 'InPartA4')
|
||||
CreateSplitBottomPart( tbIdInLoopTC, Pz_Top, CMP.SWater)
|
||||
|
||||
--TOOL.SaveMePlease()
|
||||
TOOL.SaveMePlease()
|
||||
|
||||
|
||||
TOOL.CreateDimensionLayer()
|
||||
@@ -468,7 +480,7 @@ function CMP_Draw(bPreview)
|
||||
OrigData()
|
||||
end
|
||||
--EgtSaveFile(EgtGetStringFromIni( "Vein3D", "Vein3D_Dir", "", EgtGetIniFile()) ..'\\'.. "FOO.nge")
|
||||
--EgtSaveFile("D:\\Temp\\marmo\\Vein3D\\piano_assemblato.nge")
|
||||
EgtSaveFile("D:\\Temp\\marmo\\Vein3D\\piano_assemblato.nge")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user