29 Commits

Author SHA1 Message Date
Carlo Baronchelli 8341003175 Caricato file ... da Sara 00a 2021-10-06 14:13:38 +02:00
carlo.baronchelli 9d0d0b1e81 Appunti 2021-09-04 08:24:45 +02:00
carlo.baronchelli 9095e69345 Aggiunto caso [c] (solo messaggio di errore) 2021-09-03 08:47:12 +02:00
carlo.baronchelli ff6d52569a Correzioni, modifiche (componenti di spostamento es Lx1a, Lx1b ... calcolate sempre positive 2021-09-01 18:19:02 +02:00
carlo.baronchelli 1171fd6e6e Ridenominazione da caso [c] a caso [b] 2021-09-01 12:30:38 +02:00
carlo.baronchelli bc162bde61 Caso [c] = due angoli consecutivi acuti, tre frontalini consecutivi; test positivo 2021-08-30 19:13:12 +02:00
carlo.baronchelli d58de29aee Correzioni al termine aggiuntivo per gli spostamenti 2021-08-28 00:27:24 +02:00
carlo.baronchelli c5731a50fb Test e correzioni su inclinazione tagli 2021-08-27 22:56:55 +02:00
carlo.baronchelli 4d7a39f394 Correzioni 2021-08-25 20:35:03 +02:00
carlo.baronchelli ae8ce943aa Casi a.ls, a.lp 2021-08-25 18:24:43 +02:00
carlo.baronchelli 549ece03ae Punto di salvataggio funzionante 2021-08-25 17:14:12 +02:00
Carlo Baronchelli 805e964d96 Proseguo con spostamenti 2021-08-25 13:33:18 +02:00
carlo.baronchelli 265cda35d4 Aggiunto primi spostamenti 2021-08-25 10:54:31 +02:00
Carlo Baronchelli 826bbbff8b Iniziato inserimento spostamenti : caso 'a.r' = un solo angolo consecutivo 'a dx' 2021-08-24 19:35:06 +02:00
carlo.baronchelli d60c5f933c Correzioni 2021-08-24 14:49:50 +02:00
Carlo Baronchelli 7553f4c801 Correzioni 2021-08-23 19:46:14 +02:00
Carlo Baronchelli 89d218a7e6 Iniziato (nuovamente) calcolo degli spostamenti con trigonometria (caso ar) 2021-08-23 19:45:27 +02:00
carlo.baronchelli fed54cebf7 Solo commenti (classificazione casi per spostemento dei rettangoli) 2021-08-23 14:50:16 +02:00
Carlo Baronchelli 8963bf05c4 Eliminazione dei BBox e inzio del calcolo delle intersezione tra 'rette' dei lati dei rettangoli 2021-08-19 20:26:47 +02:00
carlo.baronchelli 57fbef427a BBoxGlob funzionanti. BBoxRef non funzionanti per ora 2021-08-18 20:35:00 +02:00
carlo.baronchelli c6539d750f Prove con Bbox 2021-08-18 16:07:41 +02:00
carlo.baronchelli 68b1e82266 Un po' d'ordine per l'approccio al calcolo di intersezioni tramite Bbox 2021-08-13 19:00:45 +02:00
carlo.baronchelli 5f987472e3 Ultimato modifiche dopo nuovi ref e dopo ridenominazione dei campi dei record 'SideRec' 2021-08-13 18:06:01 +02:00
Carlo Baronchelli de5e8bf8d1 Un po' d'ordine .... 2021-08-11 19:16:09 +02:00
Carlo Baronchelli 659a0e050c Introduz. nuovi istemi di riferimento, orientati secondo i lati del 'compo', per alzatine e frontalini: OK 2021-08-11 19:05:01 +02:00
Carlo Baronchelli b7b1de5375 fix commento 2021-08-10 20:00:27 +02:00
Carlo Baronchelli f214ebbee3 Merge branch 'Modifica_SideTab_-_Prova_'puntatori'' of https://gitlab.steamware.net/egalware/frontalini into NewMaster 2021-08-10 19:56:53 +02:00
Carlo Baronchelli 1d6996f39a Come precedente 2021-08-10 19:45:29 +02:00
Carlo Baronchelli 4e1b4d31fb Modifiche a seguito ridenominazione dei campi di TabSide - Prove con sistemi di riferimento locali 2021-08-10 19:43:21 +02:00
25 changed files with 3541 additions and 262 deletions
Binary file not shown.
+292
View File
@@ -0,0 +1,292 @@
-- EgtCompoMsg.lua by EgalTech s.r.l. 2018/07/24
-- Messaggi per componenti
-- Tavola per definizione modulo
local EgtCompoMsg = {}
print( 'EgtCompoMsg started')
if EgtGetLanguage() == 'ITA' then
EgtCompoMsg[1] = 'Ingombro = '
EgtCompoMsg[2] = 'Lunghezze / Dimensioni devono essere maggiori o uguali a '
EgtCompoMsg[3] = 'La lunghezza di un lato è troppo grande rispetto agli altri due'
EgtCompoMsg[4] = 'L\'angolo dato o evidenziato deve essere minore o uguale di %s°'
EgtCompoMsg[5] = 'L\'angolo dato deve essere maggiore di %s°'
EgtCompoMsg[6] = 'La lunghezza della base B1 deve essere maggiore o uguale a '
EgtCompoMsg[7] = 'La lunghezza della base B2 deve essere maggiore o uguale a '
EgtCompoMsg[8] = 'La misura dell\'altezza H deve essere maggiore o uguale a '
EgtCompoMsg[9] = 'Ogni angolo risultante deve essere maggiore di %s°'
EgtCompoMsg[11] = 'La lunghezza del lato L2 non può essere minore di H '
EgtCompoMsg[12] = 'la somma delle lunghezze L3 e L4 deve essere maggiore della lunghezza D1 '
EgtCompoMsg[13] = 'la differenza delle lunghezze L3 e L4 deve essere minore della lunghezza D1 '
EgtCompoMsg[14] = 'l lati L1 e L3 si intersecano o generano il lato L4 troppo piccolo'
EgtCompoMsg[15] = 'La lunghezza delle diagonali deve essere maggior di ' -- o uguale
EgtCompoMsg[16] = 'la lunghezza di D1 deve essere minore della somma di L2 e L3 '
EgtCompoMsg[17] = 'la lunghezza di D1 deve essere maggiore della differenza di L2 e L3 '
EgtCompoMsg[18] = 'la lunghezza di D2 deve essere minore della somma di L1 e L2 '
EgtCompoMsg[19] = 'la lunghezza di D2 deve essere maggiore della differenza di L1 e L2 '
EgtCompoMsg[20] = 'la lunghezza di D1 deve essere minore della somma di L4 e L1 '
EgtCompoMsg[21] = 'la lunghezza di D1 deve essere maggiore della differenza di L4 e L1 '
EgtCompoMsg[22] = 'la lunghezza di D2 deve essere minore della somma di L1 e L2 '
EgtCompoMsg[23] = 'la lunghezza di D2 deve essere maggiore della differenza di L1 e L2 '
EgtCompoMsg[24] = 'la lunghezza di D3 deve essere minore della somma di L3 e L4 '
EgtCompoMsg[25] = 'la lunghezza di D3 deve essere maggiore della differenza di L3 e L4 '
EgtCompoMsg[26] = 'Il raggio deve essere maggiore o uguale a '
--Soglia
EgtCompoMsg[50] = 'I lati L2 e L4 si intersecano '
EgtCompoMsg[51] = 'Il prolungamento di L5 interseca il lato L2 '
EgtCompoMsg[52] = 'I lati L5 e L1 non si incontrano . La figura non si chiude'
EgtCompoMsg[53] = 'I lati L1 e L5 non si incontrano e L5 tende a intersecare L2 ' --non usato
EgtCompoMsg[101] = 'La differenza tra B e S deve essere maggiore o uguale a '
EgtCompoMsg[102] = 'La differenza tra A e D + E deve essere maggiore o uguale a '
-- Piani cucina
EgtCompoMsg[201] = 'Differenza lunghezze A-D troppo piccola: deve essere maggiore o uguale a '
EgtCompoMsg[202] = 'Differenza LC-LB troppo piccola: deve essere maggiore o uguale a '
EgtCompoMsg[203] = '(provv.) : Lunghezza di A è troppo piccola (o G troppo grande) ' -- provv
EgtCompoMsg[204] = '(provv.) : Lunghezza di B è troppo piccola (o G troppo grande) ' -- prov
EgtCompoMsg[205] = 'La quota Z deve essere maggiore o guale a '
EgtCompoMsg[206] = 'Il raggio R deve essere maggiore o guale a '
EgtCompoMsg[207] = '(provv.) : Lunghezza D risulterebbe minore di '
EgtCompoMsg[208] = '(provv.) : Lunghezza E risulterebbe minore di '
EgtCompoMsg[209] = '(provv.) : Lunghezza F risulterebbe minore di '
EgtCompoMsg[210] = '(provv.) : Lunghezza D risulterebbe minore di '
EgtCompoMsg[211] = '(provv.) : Lunghezza C risulterebbe minore di '
EgtCompoMsg[220] = 'L\'angolo Alfa deve essere compreso tra '
EgtCompoMsg[221] = '(provv.) : figura impossibile : i lati non si chiudono '
EgtCompoMsg[222] = '(provv.) : Lunghezza LG eccessiva'
EgtCompoMsg[223] = '(provv.) : Un lato risulta troppo piccolo , minore di '
EgtCompoMsg[224] = 'R incompatibile con dimensioni dei lati, Lungh. min ' -- provv?
-- Piani bagno
EgtCompoMsg[229] = 'H2 deve essere minore o uguale ad H'
-- Ellisse
EgtCompoMsg[230] = "'ManPar' deve essere maggiore o uguale a "
EgtCompoMsg[231] = "'ManPar' deve essere minore o uguale a "
EgtCompoMsg[240] = 'Gli assi devono essere maggiori o uguali a '
-- Cerchio
EgtCompoMsg[241] = 'Il/i diametro/i devono essere maggiori o uguali a '
-- Curve
EgtCompoMsg[250] = "F deve essere maggiore o uguale a "
EgtCompoMsg[251] = "F non deve essere superiore a L1 / 2"
EgtCompoMsg[252] = "La larghezza H è eccessiva in relazione a L1 e/o F "
EgtCompoMsg[253] = "L1-L2 deve essere maggiore o uguale a "
EgtCompoMsg[254] = "L1, L2, H non compatibili "
-- Triangolo isoscele
EgtCompoMsg[255] = "Modificare il rapporto tra B e H in modo ottenere angoli maggiori di %s° "
-- Poligono
EgtCompoMsg[256] = "Il N° di lati deve essere maggiore o uguale a "
EgtCompoMsg[257] = "Il N° di lati deve essere minore o uguale a "
EgtCompoMsg[258] = "Il lato del poligono risulta troppo piccolo : il minimo è "
-- Componenti interni
EgtCompoMsg[300] = " Il componente esce dai contorni del piano"
EgtCompoMsg[301] = "Errore nella lettura del file Dxf"
EgtCompoMsg[302] = "Errore nella elaborazione della geometria Dxf"
EgtCompoMsg[310] = 'Interasse I deve essere maggiore del diamentro D' -- due fori
EgtCompoMsg[311] = 'Interasse I2 deve essere maggiore del diamentro D2' -- tre fori
EgtCompoMsg[312] = 'Interassi I1 e/o I2 troppo piccoli rispetto alla somma dei diametri D1 e D2' -- tre fori
-- Curve bis
EgtCompoMsg[313] = 'H deve essere minore o uguale a R' -- curva A5
-- Linee Ribasso/Ribasso
EgtCompoMsg[350] = 'Lunghezza L deve essere minore di '
EgtCompoMsg[351] = 'Interasse D1 e/o D2 deve essere minore di '
EgtCompoMsg[352] = 'Interasse D1 e/o D2 deve essere maggiore di '
EgtCompoMsg[353] = 'Numero linee N deve essere maggiore di 0'
EgtCompoMsg[354] = 'Lunghezza L deve essere maggiore di '
EgtCompoMsg[355] = "L'indice di riferimento non esiste"
EgtCompoMsg[356] = "Manca ribasso"
EgtCompoMsg[357] = "Incllinazione minore di "
-- Ribasso
EgtCompoMsg[360] = 'Raggio R deve essere minore di '
EgtCompoMsg[360] = 'Raggio R deve essere maggiore di '
-- Alzatine/Frontalini
EgtCompoMsg[370] = 'non previsto'
elseif EgtGetLanguage() == 'DEU' then
EgtCompoMsg[1] = 'Box = '
EgtCompoMsg[2] = 'Sides / Dimensions must be greater than or equal to '
EgtCompoMsg[3] = 'One side is too long compared to the sum of the other two '
EgtCompoMsg[4] = 'The input or marked angle must be smaller than %s deg'
EgtCompoMsg[5] = 'The input angle must be greater or equal than %s deg'
EgtCompoMsg[6] = 'The base B1 must be greater or equal than '
EgtCompoMsg[7] = 'The base B2 must be greater or equal than '
EgtCompoMsg[8] = 'The height H must be greater or equal or equal than '
EgtCompoMsg[9] = 'Each resulting angle must be greater than %s deg'
--EgtCompoMsg[10] = 'Each resulting angle must be greater than %s deg'
EgtCompoMsg[11] = 'L2 length must be greater or equal then H '
EgtCompoMsg[12] = 'Sum of lengths L3 e L4 sum must be greater then D1 length '
EgtCompoMsg[13] = 'Length difference between L3 and L4 must be smaller then D1 length '
EgtCompoMsg[14] = 'L1 and L3 intersect or L4 length is too small'
EgtCompoMsg[15] = 'Diagonal length must be greater than ' -- or equal
EgtCompoMsg[16] = 'Diagonal length D1 must be smaller then sum of legths L2 and L3 '
EgtCompoMsg[17] = 'Diagonal length D1 must be greater then difference of sides L2 and L3 '
EgtCompoMsg[18] = 'Diagonal length D2 must be smaller then sum of legths L1 and L2 '
EgtCompoMsg[19] = 'Diagonal length D2 must be greater then difference of sides L1 and L2 '
EgtCompoMsg[20] = 'Diagonal length D1 must be smaller then sum of legths L4 and L1 '
EgtCompoMsg[21] = 'Diagonal length D1 must be greater then difference of sides L4 and L1 '
EgtCompoMsg[22] = 'Diagonal length D2 must be smaller then sum of legths L1 and L2 '
EgtCompoMsg[23] = 'Diagonal length D2 must be greater then difference of sides L1 and L2 '
EgtCompoMsg[24] = 'Diagonal length D3 must be smaller then sum of legths L3 and L4 '
EgtCompoMsg[25] = 'Diagonal length D3 must be greater then difference of sides L3 and L4 '
EgtCompoMsg[26] = 'Radius must be greater than or equal to '
--Soglia
EgtCompoMsg[50] = 'L4 and L2 intersect '
EgtCompoMsg[51] = 'Extension of L5 intersects L2 '
EgtCompoMsg[52] = "Sides L1 and L5 don't meet "
EgtCompoMsg[53] = 'I lati L1 e L5 non si incontrano e L5 tende a intersecare L2 ' -- not used
EgtCompoMsg[101] = 'B - S must be greater than or equal to '
EgtCompoMsg[101] = 'A - D - E must be greater than or equal to '
-- Piani cucina
EgtCompoMsg[201] = 'LA - LD must be greater than or equal to '
EgtCompoMsg[202] = 'LC - LB must be greater than or equal to '
EgtCompoMsg[203] = '(provv.) : Lunghezza di A è troppo piccola (o G troppo grande) ' -- provv
EgtCompoMsg[204] = '(provv.) : Lunghezza di B è troppo piccola (o G troppo grande) ' -- prov
EgtCompoMsg[205] = '(provv.) : La quota Z deve essere maggiore o guale a ' --provv.
EgtCompoMsg[206] = '(provv.) : Il raggio R deve essere maggiore o guale a ' --provv
EgtCompoMsg[207] = '(provv.) : Differenza lunghezze A-C risulterebbe minore di ' --provv
EgtCompoMsg[208] = '(provv.) : Lunghezza lato E risulterebbe minore di ' --provv
EgtCompoMsg[209] = '(provv.) : Lunghezza lato F risulterebbe minore di ' --provv
EgtCompoMsg[210] = '(provv.) : Lunghezza D risulterebbe minore di ' --provv
EgtCompoMsg[211] = '(provv.) : Lunghezza C risulterebbe minore di ' --provv
EgtCompoMsg[220] = 'Alfa angle must lie between '
EgtCompoMsg[221] = '(provv.) : figura impossibile ' --provv
EgtCompoMsg[222] = '(provv.) : Lunghezza LG eccessiva' --provv
EgtCompoMsg[223] = '(provv.) : Un lato risulta troppo piccolo, minore di ' --provv
EgtCompoMsg[224] = '(provv.) : R incompatibile con dimensioni dei lati, Lungh. min ' -- provv
-- Piani bagno
EgtCompoMsg[229] = 'H2 must be smaller than or equal to H'
-- Ellisse
EgtCompoMsg[230] = "'ManPar' must be greater than or equal to "
EgtCompoMsg[231] = "'ManPar' must be smaller than or equal to "
EgtCompoMsg[240] = 'Axes lengths must be greater than or equal to '
-- Cerchio
EgtCompoMsg[241] = 'Diameter must be greater than or equal to '
-- Curva
EgtCompoMsg[250] = "F must be greater than or equal to "
EgtCompoMsg[251] = "F must not be greater than L1 / 2"
EgtCompoMsg[252] = "H is excessive in relation to L1 and/or F"
EgtCompoMsg[253] = "L1 - L2 must be greater then "
EgtCompoMsg[254] = "Length L1, L2, H not compatible"
-- Triangolo isoscele
EgtCompoMsg[255] = "Modificare il rapporto tra B e H in modo da ottenere angoli maggiori di %s deg" --provv
-- Poligono
EgtCompoMsg[256] = "The number of sides must be greater than or equal to "
EgtCompoMsg[257] = "The number of sides must be less than or equal to "
EgtCompoMsg[258] = "The side of the polygon is too small: the minimum is "
-- Componenti interni
EgtCompoMsg[300] = "The component goes beyond surface boundaries"
EgtCompoMsg[301] = "Error loading Dxf file"
EgtCompoMsg[302] = "Error processing Dxf geometry"
EgtCompoMsg[310] = 'Interaxis I must be greater than diameter D' -- due fori
EgtCompoMsg[311] = 'Interaxis I2 must be greater than diameter D2' -- tre fori
EgtCompoMsg[312] = 'Interaxis I1 and/or I2 too small with respect to the sum of diameters D1 and D2' -- tre fori
-- Curve bis
EgtCompoMsg[313] = 'H deve essere minore o uguale a R' -- curva A5, provv
-- Linee Ribasso
EgtCompoMsg[350] = 'Lunghezza L deve essere minore di '
EgtCompoMsg[351] = 'Interasse D1 e/o D2 deve essere minore di '
EgtCompoMsg[352] = 'Interasse D1 e/o D2 deve essere maggiore di '
EgtCompoMsg[353] = 'Numero linee N deve essere maggiore di 0'
EgtCompoMsg[354] = 'Lunghezza L deve essere maggiore di '
EgtCompoMsg[355] = "L'indice di riferimento non esiste"
EgtCompoMsg[356] = "Manca ribasso"
EgtCompoMsg[357] = "Slope must be less than "
-- Ribasso
EgtCompoMsg[360] = 'Raggio R deve essere minore di '
EgtCompoMsg[360] = 'Raggio R deve essere maggiore di '
-- Alzatine/Frontalini
EgtCompoMsg[370] = 'non previsto' -- da tradurre
else -- default 'ENG'
EgtCompoMsg[1] = 'Box = '
EgtCompoMsg[2] = 'Sides / Dimensions must be greater than or equal to '
EgtCompoMsg[3] = 'One side is too long compared to the sum of the other two '
EgtCompoMsg[4] = 'The input or marked angle must be smaller than %s deg'
EgtCompoMsg[5] = 'The input angle must be greater or equal than %s deg'
EgtCompoMsg[6] = 'The base B1 must be greater or equal than '
EgtCompoMsg[7] = 'The base B2 must be greater or equal than '
EgtCompoMsg[8] = 'The height H must be greater or equal or equal than '
EgtCompoMsg[9] = 'Each resulting angle must be greater than %s deg'
EgtCompoMsg[11] = 'L2 length must be greater or equal then H '
EgtCompoMsg[12] = 'Sum of lengths L3 e L4 sum must be greater then D1 length '
EgtCompoMsg[13] = 'Length difference between L3 and L4 must be smaller then D1 length '
EgtCompoMsg[14] = 'L1 and L3 intersect or L4 length is too small'
EgtCompoMsg[15] = 'Diagonal length must be greater than ' -- or equal
EgtCompoMsg[16] = 'Diagonal length D1 must be smaller then sum of legths L2 and L3 '
EgtCompoMsg[17] = 'Diagonal length D1 must be greater then difference of sides L2 and L3 '
EgtCompoMsg[18] = 'Diagonal length D2 must be smaller then sum of legths L1 and L2 '
EgtCompoMsg[19] = 'Diagonal length D2 must be greater then difference of sides L1 and L2 '
EgtCompoMsg[20] = 'Diagonal length D1 must be smaller then sum of legths L4 and L1 '
EgtCompoMsg[21] = 'Diagonal length D1 must be greater then difference of sides L4 and L1 '
EgtCompoMsg[22] = 'Diagonal length D2 must be smaller then sum of legths L1 and L2 '
EgtCompoMsg[23] = 'Diagonal length D2 must be greater then difference of sides L1 and L2 '
EgtCompoMsg[24] = 'Diagonal length D3 must be smaller then sum of legths L3 and L4 '
EgtCompoMsg[25] = 'Diagonal length D3 must be greater then difference of sides L3 and L4 '
EgtCompoMsg[26] = 'Radius must be greater than or equal to '
--Soglia
EgtCompoMsg[50] = 'L4 and L2 intersect '
EgtCompoMsg[51] = 'Extension of L5 intersects L2 '
EgtCompoMsg[52] = "Sides L1 and L5 don't meet "
EgtCompoMsg[53] = 'I lati L1 e L5 non si incontrano e L5 tende a intersecare L2 ' -- not used
EgtCompoMsg[101] = 'B - S must be greater than or equal to '
EgtCompoMsg[101] = 'A - D - E must be greater than or equal to '
-- Piani cucina
EgtCompoMsg[201] = 'LA - LD must be greater than or equal to '
EgtCompoMsg[202] = 'LC - LB must be greater than or equal to '
EgtCompoMsg[203] = '(provv.) : Lunghezza di A è troppo piccola (o G troppo grande) ' -- provv
EgtCompoMsg[204] = '(provv.) : Lunghezza di B è troppo piccola (o G troppo grande) ' -- prov
EgtCompoMsg[205] = '(provv.) : La quota Z deve essere maggiore o guale a ' --provv.
EgtCompoMsg[206] = '(provv.) : Il raggio R deve essere maggiore o guale a ' --provv
EgtCompoMsg[207] = '(provv.) : Differenza lunghezze A-C risulterebbe minore di ' --provv
EgtCompoMsg[208] = '(provv.) : Lunghezza lato E risulterebbe minore di ' --provv
EgtCompoMsg[209] = '(provv.) : Lunghezza lato F risulterebbe minore di ' --provv
EgtCompoMsg[210] = '(provv.) : Lunghezza D risulterebbe minore di ' --provv
EgtCompoMsg[211] = '(provv.) : Lunghezza C risulterebbe minore di ' --provv
EgtCompoMsg[220] = 'Alfa angle must lie between '
EgtCompoMsg[221] = '(provv.) : figura impossibile ' --provv
EgtCompoMsg[222] = '(provv.) : Lunghezza LG eccessiva' --provv
EgtCompoMsg[223] = '(provv.) : Un lato risulta troppo piccolo, minore di ' --provv
EgtCompoMsg[224] = '(provv.) : R incompatibile con dimensioni dei lati, Lungh. min ' -- provv
-- Piani bagno
EgtCompoMsg[229] = 'H2 must be smaller than or equal to H'
EgtCompoMsg[230] = "'ManPar' must be greater than or equal to "
EgtCompoMsg[231] = "'ManPar' must be smaller than or equal to "
-- Ellisse
EgtCompoMsg[240] = 'Axes lengths must be greater than or equal to '
-- Cerchio
EgtCompoMsg[241] = 'Diameter must be greater than or equal to '
-- Curva
EgtCompoMsg[250] = "F must be greater than or equal to "
EgtCompoMsg[251] = "F must not be greater than L1 / 2"
EgtCompoMsg[252] = "H is excessive in relation to L1 and/or F"
EgtCompoMsg[253] = "L1 - L2 must be greater then "
EgtCompoMsg[254] = "Length L1, L2, H not compatible"
-- Triangolo isoscele
EgtCompoMsg[255] = "Modificare il rapporto tra B e H in modo da ottenere angoli maggiori di %s deg" --provv
-- Poligono
EgtCompoMsg[256] = "The number of sides must be greater than or equal to "
EgtCompoMsg[257] = "The number of sides must be less than or equal to "
EgtCompoMsg[258] = "The side of the polygon is too small: the minimum is "
-- Componenti interni
EgtCompoMsg[300] = "The component goes beyond surface boundaries"
EgtCompoMsg[301] = "Error loading Dxf file"
EgtCompoMsg[302] = "Error processing Dxf geometry"
EgtCompoMsg[310] = 'Interaxis I must be greater than diameter D' -- due fori
EgtCompoMsg[311] = 'Interaxis I2 must be greater than diameter D2' -- tre fori
EgtCompoMsg[312] = 'Interaxis I1 and/or I2 too small with respect to the sum of diameters D1 and D2' -- tre fori
-- Curve bis
EgtCompoMsg[313] = 'H deve essere minore o uguale a R' -- curva A5, provv
-- Linee Ribasso
EgtCompoMsg[350] = 'Lenght L must be less than '
EgtCompoMsg[351] = 'Interaxis D1 and/or D2 must be less than '
EgtCompoMsg[352] = 'Interaxis D1 and/or D2 must be bigger than '
EgtCompoMsg[353] = 'Line number N must be bigger than 0'
EgtCompoMsg[354] = 'Lenght L must be bigger than '
EgtCompoMsg[355] = "L'indice di riferimento non esiste"
EgtCompoMsg[356] = "Manca ribasso"
EgtCompoMsg[357] = "Slope must be less than "
-- Ribasso
EgtCompoMsg[360] = 'Radius R must be less than '
EgtCompoMsg[360] = 'Radius R must be bigger than '
-- Alzatine/Frontalini
EgtCompoMsg[370] = 'non previsto' -- da tradurre
end
return EgtCompoMsg
@@ -0,0 +1,739 @@
-- 2021/06/__
-- (exRettangolo interno dati base e altezza)
-- 21/06/2021 Nicola Pievani: creazione del file Alz&Front
-- 05/07/2021 Nicola Pievani: Inserisco commenti
-- 08/07/2021 CB: inizio disegno dei 'rettangoli esterni'
-- 00b 10/07/2020 CB: costruzione della tabella "MyTab"
-- 00c 13/07/2021 CB: introduzone record "SideREc" e tabella "SideTab"
-- 00d 15/07/2021 CB: introduzione funzione per disegno rettangoli
-- 00e 16/07/2021
-- 00f 20/07/2021
-- 21/07/2021 - aggiornato progetto in GIT
-- 26/07/2021 - 'chiuso' i rettangoli, noiminati i rispettivi lati
-- - studio casi per inserimento InfoAF per tagli inclinati
-- 28/07/2021 - semplificazione di SideTab e aggiunta angoli tra lati consecutivi
-- 29/07/2021 - inserimento InfoAF per tagli inclinati
-- 30/07/2021 - separazione dei casi tra frontalini e alzatine
-- 1/08/e segg - funzione SideAngSetInfo con anche prova etichette inclinazione
-- 3/08/2021 - inserimento info con riferimento al lato del
-- - inizio studio per 'spostamenti'
-- 9/08/2021 - aggiunto PzId in SideRec ('spostando' tutti gli altri campi !)
-- 20/08/2021 - prova calcolo intersezioni con 'pseudorette' dei lati dei rettangoli
-- 23/08/2021 - inizio calcolo spostamenti con trigonometria
-- 30/08/2021 - caso [b(r1r2r3
-- 06/10/2021 - da Sara 00a con modifiche by Nicola
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( true)
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
require( 'EgtCompo')
-- Valori limite
local LgMin = 10
local RMin = 5
-- Parametri : dichiarazione e valori standard
--.T (tipo) : 0=null, 1=bool, 2=int, 3=len, 4=num, 5=string
local CMP = {}
-- elenco dei parametri visualizzati nell'interfaccia del programma OMAG-Cut
CMP.A_Height=30 -- altezza delle alzatine
CMP.F_Height=30 -- altezza dei frontalini
CMP.A_DeltaAng=0.5 -- angolo (semiangolo) di incremento per tagli inclinati
CMP.F_DeltaAng=0.5
CMP.ThicknessRaw=10 -- spessore del grezzo
-- parametri passati da OmagCut
CMP.BBoxRad = 1000
CMP.HeightText = 100
--
_G.CMP = CMP
-- 2021/08
-- Disegna i lati di un rattangolo dati layer, Punto, base, altezza;
-- 'allineato al sistema di riferimento' =: base parallela al sistema di riferimento dato
-- sarebbe superata dall'uso diretto della funzione di disegno Rettangolo
-- se non servissse distinguare i singoli lati
local function DrawRectangle (Pz, Lay, BaseL, HeightL, sName, sReference, Delta1, Delta2)
-- insrisco un commento nel pezzo per descriverlo
EgtSetInfo( Pz, "CMP", "AlzFront")
local Lr = EgtGroup( Pz, GDB_RT.LOC)
EgtSetName( Lr, "Region")
-- sul prim lato della figura copio l'identificatico univoco presente nel lato della cucina a cui è associato
local Pt = Point3d( -Delta1,0,0)
local l1 = EgtLinePDL( Lay, Pt, 0, BaseL)
EgtSetName( l1, sName.." l1")
EgtSetInfo( l1, "RefAF", sReference)
local l2 = EgtLinePDL( Lay, EgtEP( l1), 90, HeightL)
EgtSetName( l2, sName.." -l2")
local l3 = EgtLinePDL( Lay, EgtEP( l2), 180, BaseL)
EgtSetName( l3, sName.." -l3")
local l4 = EgtLine( Lay, EgtEP( l3), EgtSP( l1))
EgtSetName( l4,sName.." -l4")
local RectContour = EgtCurveCompo(Lay,{l1,l2,l3,l4},false)
local s1 = EgtSurfFlatRegion(Lr,RectContour)
if CMP.ERR == 0 then
EgtSetColor(s1,AQUA())
else
EgtSetColor(s1,ORANGE())
end
EgtSetAlpha(s1,25)
EgtErase( RectContour)
return l1, l2, l3, l4
end
--
-- Scrittura info e etichetta con inclinazione dei lati dei rettangoli
local function SideAngSetInfo(SideId, Lay, Gamma, dOffset, dHLbl)
EgtSetInfo( SideId, "SideAng", Gamma) -- -F_Delta?
EgtSetInfo( SideId, "OrigSideAng", Gamma) -- -F_Delta?
local Lbl = EgtNumToString(Gamma,1)..'°'
LblL1 = AddLabelAl( Lay, SideId, dOffset*0.02, Lbl, dHLbl, -90, BLACK())
end
--
-- rimuove l'informazione del taglio inclinato dal lato indicato del piano cucina
local function ResetSideAng( CurrSide) -- IsModify
if EgtGetInfo( CurrSide, "IsModify", 'i') == 0 then
return
end
if EgtExistsInfo( CurrSide, "SideAng") then
EgtRemoveInfo( CurrSide, "SideAng")
EgtRemoveInfo( CurrSide, "OrigSideAng")
end
end
--
-- costruisco la teballe che contiene le informazioni prese dal piano cucina
-- |LEGENDA 1: campi di SideTab|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start Vector; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
-- |.RefAF = GUID Reference.|
local function LoadData( SideTab, Lw, Le, dOffset, dHLbl)
-- contatore usato per conoscere il numero di lati inserito
local SideNum =1
-- ricerco nel layer OutLoop tutti i lati del piano cucina
local CurrSide = EgtGetFirstInGroup( Lw)
local PrecSide = nil
while CurrSide ~= nil do
local SideRec = {}
-- recupero informazione sul tipo di rettangolo da costruire (Alzatina o Frontalino)
local InfoAF = EgtGetInfo( CurrSide, "AF", 'i')
-- recupero informazione del riferimento univoco generato in OmagCUT (deve esistere)
local InfoRefGUID = EgtGetInfo( CurrSide, "RefAF", 's')
-- se non esite nessuna informazione allora inizializzo a 0
if InfoAF == nil then
InfoAF = 0
end
-- se primo lato
if SideNum == 1 then
SideRec = {IdSd = CurrSide, IdPz = nil, InfoSd = InfoAF, RecPrv = 0, RecNxt = SideNum+1,
VectS = EgtSV(CurrSide), VectE = EgtEV(CurrSide), RefAF = InfoRefGUID}
-- se lato successivo al primo
else
local v1 = SideTab[SideNum-1].VectE
local v2 = EgtSV(CurrSide)
local Angv1v2 = atan2( (v1^v2)*Z_AX(),v1*v2)
SideRec = { IdSd = CurrSide, IdPz = nil, InfoSd = InfoAF, RecPrv = SideNum-1, RecNxt = SideNum+1,
VectS = EgtSV(CurrSide), VectE = EgtEV(CurrSide), RefAF = InfoRefGUID,
zPrvAng = Angv1v2 }
-- Assegno la lato precedente (SideNum-1) l'informazione del lato corrente (SideNum)
SideTab[SideNum-1].zNxtAng = Angv1v2
end
-- (per visualizzazione in OmagCUT)
if InfoAF == 1 then
EgtSetColor(CurrSide, 'RED')
elseif InfoAF == 2 then
EgtSetColor(CurrSide, 'GREEN')
else
-- elimino eventuali angoli di taglio inseriti dovuti a precedenti frontalini
ResetSideAng( CurrSide)
EgtSetColor(CurrSide, 'BLACK')
end
-- Inserico nella tabella la tabella costruita temporaneamente per salvare i dati
table.insert(SideTab, SideRec)
-- passo al lato successivo
PrecSide = CurrSide
CurrSide = EgtGetNext( CurrSide)
SideNum = SideNum + 1
end --while
-- completo la tabella con i riferimenti tra ultimo lato e primo (in quanto successivo all'ultimo)
if #SideTab > 1 then
local v1 = SideTab[#SideTab].VectE
local v2 = SideTab[1].VectS
local Angv1v2 = atan2( (v1^v2)*Z_AX(),v1*v2)
SideTab[#SideTab].RecNxt = 1
SideTab[1].RecPrv = #SideTab
SideTab[#SideTab].zNxtAng = Angv1v2
SideTab[1].zPrvAng = Angv1v2
end
end
--
-- a partire dal primo pezzo (il piano cucina) elimino tutti i pezzi "Alz-Front"
local function ResetDraw( Pz)
local TabOfPart = {}
local CurrPz = EgtGetNextPart( Pz)
while CurrPz ~= nil do
if "Alz-Front" == EgtGetName( CurrPz) then
table.insert( TabOfPart, CurrPz)
end
CurrPz = EgtGetNextPart( CurrPz)
end
EgtErase( TabOfPart)
end
--
-- Funzione di disegno
local function CMP_Draw(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
CMP.ERR = 0
CMP.MSG = ''
-- Assegno l'angolo di incremento per i tagli inclinati
local F_Delta = CMP.F_DeltaAng
local A_Delta = CMP.A_DeltaAng
-- Assegno l'altezza
local FH = CMP.F_Height
local AH = CMP.A_Height
-- Assegno la dimensione di riferimento (=1/10 del 'raggio' della figura)
local dDim = CMP.BBoxRad
local dHLbl = CMP.HeightText
local dStdOffs = dDim*.05 -- vedi etichettatura lati inclinati
local dOffsR = dDim*.2 -- distanziamento dei rettangoli dai lati del componente
local dOffsC = dDim*.25 -- 'costante' aggiuntiva per spostamenti
--
CMP.ERR = 0
CMP.MSG = ''
-- Pezzo e Layer già definiti
local Pz = EgtGetFirstGroupInGroup( GDB_ID.ROOT)
-- ripulisco il disegno
ResetDraw( Pz)
if not Pz then
CMP.ERR = 5
CMP.MSG = "Pezzo non trovato"
return
end
local La = EgtGetFirstNameInGroup( Pz, "LayAux")
local Le = EgtGetFirstNameInGroup( Pz, "Etichette")
local Lq = EgtGetFirstNameInGroup( Pz, "Quotature")
local Lo = EgtGetFirstNameInGroup( Pz, "Region")
local Lw = EgtGetFirstNameInGroup( Pz, "OutLoop")
local Ls = EgtGetFirstNameInGroup( Pz, "SelectRegion")
--local PzAF = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- ??? nuova part: alzatine e frontalini ???????
--local LyA = EgtGroup(PzAF,GDB_RT.LOC) -- layer alzatine
--EgtSetName(LyA,'Alzatine')
--local LyF = EgtGroup(PzAF,GDB_RT.LOC) -- layer frontalini
--EgtSetName(LyF,'Frontalini')
--local LyAe = EgtGroup(PzAF,GDB_RT.LOC) -- layer etichette alzatine
--EgtSetName(LyAe,'Etich_Alzatine')
--local LyFe = EgtGroup(PzAF,GDB_RT.LOC) -- layer etichette frontalini
--EgtSetName(LyFe,'Etich_Frontalini')
if not Ls then
Ls = EgtGroup( Pz, GDB_RT.LOC)
EgtSetName( Ls, "SelectRegion")
end
--[[ **COMMENTATO PER TEST**
if not La or not Lo or not Lw or not Le or not Lq then
CMP.ERR = 6
CMP.MSG = "Layer non trovato"
return
end
]]
local Lr = EgtGetFirstNameInGroup( Pz, "ErrorLay")
if Lr then
EgtEmptyGroup(Lr)
else
Lr = EgtGroup( Pz, GDB_RT.LOC)
EgtSetName( Lr, "ErrorLay")
end
--[[ **COMMENTATO PER TEST**
-- spengo i layer Aux e Quotature
EgtSetStatus( La, GDB_ST.OFF)
EgtSetStatus( Lq, GDB_ST.OFF)
]]
local sInd = nil
--[[ faccio scorrere tutti gli elementi del layer OutLoop e di ognuno leggo se contiente nelle Info "AF=x"
"AF=0" ( o nil) => al lato non deve essere associatu nulla
"AF=1" => al lato deve essere associto un'alzatina
"AF=2" => al lato deve essere associato un frontalino
nel ciclo while che segue carico una tabella contenente tutti i lati e i riferimenti ai lati successivi,
oltre a informazioni sulle direzioni iniziali/finali dei lati cghe seguono/precedono.
(In questa fase possono essere aggiunte altre informazioni...)
La variabile sMsg è usta dal programma per verificare che i lati letti dalla tabella siano gli stessi
passati dal programma
]]
local sMsg = " "
local SideNum =1
-- **COSTRUZIONE DELLA TABELLA DEI LATI DEL COMPONENTE** (es. piano cucina)
-- --------------------------------------------------------------------
local SideTab = {}
-- |LEGENDA 1: campi di SideTab|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
-- |.RefAF = GUID Reference.|
LoadData( SideTab, Lw)
-- restituisco un messaggio al programma OmagCUT
CMP.MSG = sMsg
-- **COSTRUZIONE DELLE FIGURE** (rettangoli) rappresentative di alzatine o frontalini
-- -------------------------------------------------------------------------------
for SideNum = 1 , #SideTab do
-- se è richiesto un'alzatina o un frontalino (InfoSd=1 oppure InfoSd=2)
if SideTab[SideNum].InfoSd > 0 then
-- recupero le informazioni dalla tabella
local Side = SideTab[SideNum].IdSd
local SVect = SideTab[SideNum].VectS
local EVect = SideTab[SideNum].VectE
local RefToAF = SideTab[SideNum].RefAF
local BaseL; local HeightL
local sName
-- Costruisco il sistema di riferimento per il rettangolo
local Pt = EgtEP( Side) + VRotated( EVect*dOffsR, -90)
local Frame = Frame3d( Pt, -EVect, VRotated(EVect,-90), Vector3d(0,0,1))
-- nuova parte per alzatina o frontalino
local Pz = EgtGroup(GDB_ID.ROOT, Frame, GDB_RT.GLOB)
EgtSetName(Pz,"Alz-Front")
-- assegno alla tabella l'Id del pezzo appena creato
SideTab[SideNum].IdPz = Pz
-- creo Layer per il pezzo appena creato
local Lay = EgtGroup( Pz)
EgtSetName(Lay,"OutLoop")
local LayLbl = EgtGroup( Pz)
EgtSetName(LayLbl,"Etichette")
-- |ALZATINA|
if SideTab[SideNum].InfoSd == 1 then
EgtSetColor(Lay,RED(),100,true)
BaseL = EgtCurveLength( Side)
sName = "Side "..SideNum.." -A"
HeightL = AH
-- |FRONTALINO|
elseif SideTab[SideNum].InfoSd == 2 then
EgtSetColor(Lay,GREEN(),100,true)
BaseL = EgtCurveLength( Side)
sName = "Side "..SideNum.." -F"
HeightL = FH
SideTab[SideNum].Frame = Frame --**?????????????????***** anche QUI *??????????????<<<<<<
end
-- chiamo la funzione per il disegno (senso antiorario) dei lati del rettangolo 'allineato'
--local l1, l2, l3, l4 = DrawRectangle (Pz, Lay, BaseL, HeightL, sName, RefToAF)
-- inserisco gli Id dei lati del rettangolo nel Side_Record in SideTab
--SideTab[SideNum].l1 = l1; SideTab[SideNum].l2 = l2; SideTab[SideNum].l3 = l3; SideTab[SideNum].l4 = l4
-- **INFO PER TAGLI INCLINATI**
-- --------------------------
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle|
-- |.RefAF = GUID Reference.|
local Tab = SideTab
local N = SideNum
local Alphap; local Alphas
local Betap; local Betas
-- angoli tra lato precedente e attuale
Alphap = Tab[N].zPrvAng;
if Alphap >= 0 then
Betap = 180-Alphap
else
Betap = (180+Alphap)
end
-- angoli tra lato attuale e successivo
Alphas = Tab[N].zNxtAng;
if Alphas >= 0 then
Betas = 180-Alphas
else
Betas = (180+Alphas)
end
local Gamma1 -- angolo di taglio su lato l2
local Gamma2 -- angolo di taglio su lato l4
local Delta1=0
local Delta2=0
-- **ALZATINE**
if Tab[N].InfoSd == 1 then
-- CASI RIFERITI AL LATO PRECEDENTE
-- **1) Ap0.sx** = non continua da lato precedente, angolo 'a sx'
if (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
Gamma1 = 90 - Betap
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso **p0.sx.2** = Alphap <= 90, non si fa taglio inclinato)
-- **2) Ap0.dx** = non continua da lato precedente, angolo 'a dx'
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
Gamma1 = Betap - 90 -- meno F_Delta ???????
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- **3) Ap1.sx** = continua da lato precedente, angolo 'a sx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
Gamma1 = (90-Betap/2-A_Delta)
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) Ap1.dx** = continua da lato precedente, angolo 'a dx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
Gamma1 = -(90-Betap/2-A_Delta)
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- CASI RIFERITI AL LATO SUCCESSIVO
-- **1) As0.sx** = non continua al lato successivo, angolo 'a sx'
if (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
Gamma2 = 90 - Betas -- meno F_Delta ???
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **2) As0.dx** = non continua al lato successivo, angolo 'a dx'
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
Gamma2 = Betas - 90 -- meno F_Delta ???
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **3) As1.sx** = continua al lato successivo, angolo 'a sx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
Gamma2 = (90-Betas/2-A_Delta)
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) As1.dx** = continua al lato successivo, angolo 'a dx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
Gamma2 = - (90-Betas/2-A_Delta)
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
Delta1 = -tan( Gamma1)*CMP.ThicknessRaw
Delta2 = -tan( Gamma2)*CMP.ThicknessRaw
-- chiamo la funzione per il disegno (senso antiorario) dei lati del rettangolo 'allineato'
local l1, l2, l3, l4 = DrawRectangle (Pz, Lay, BaseL + Delta1 + Delta2 , HeightL, sName, RefToAF, Delta1, Delta2)
-- inserisco gli Id dei lati del rettangolo nel Side_Record in SideTab
SideTab[SideNum].l1 = l1; SideTab[SideNum].l2 = l2; SideTab[SideNum].l3 = l3; SideTab[SideNum].l4 = l4
SideAngSetInfo ( l2, LayLbl, Gamma1, dStdOffs, dHLbl)
SideAngSetInfo ( l4, LayLbl, Gamma2, dStdOffs, dHLbl)
-- **FRONTALINI**
elseif Tab[N].InfoSd == 2 then
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle|
-- |.RefAF = GUID Reference.|
-- CASI RIFERITI AL LATO PRECEDENTE
-- **1) Fp0.sx** = non continua da lato precedente, angolo 'a sx'
if (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
if Alphap > 90 then
Gamma1 = Betap - 90 -- meno F_Delta ????
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso Alphap <= 90, non si fa taglio inclinato)
else
Gamma1 = 0
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **2) Fp0.dx** = non continua da lato precedente, angolo 'a dx'
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
if -Alphap > 90 then
Gamma1 = 90 - Betap -- meno F_Delta ????
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso -Alphap <= 90, non si fa taglio inclinato)
else
Gamma1 = 0
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **3) Fp1.sx** = continua da lato precedente, angolo 'a sx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
Gamma1 = -(90-Betap/2+F_Delta)
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) Fp1.dx** = continua da lato precedente, angolo 'a dx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
Gamma1 = 90-Betap/2-F_Delta
--SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- CASI RIFERITI AL LATO SUCCESSIVO
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle|
-- |.RefAF = GUID Reference.|
-- **1) Fs0.sx** = non continua al lato successivo, angolo 'a sx'
if (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
if Alphas > 90 then
Gamma2 = Betas - 90 -- meno F_Delta ????
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso Alphap <= 90, non si fa taglio inclinato)
else
Gamma2 = 0
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **2) Fs0.dx** = non continua al lato successivo, angolo 'a dx'
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
-- **Fs0.dx.1**
if -Alphas > 90 then
Gamma2 = 90 - Betas -- meno F_Delta ????
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso -Alphap <= 90, non si fa taglio inclinato)
else
Gamma2 = 0
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **3) Fs1.sx** = continua al lato successivo, angolo 'a sx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
Gamma2 = - (90-Betas/2+F_Delta)
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) Fs1.dx** = continua al lato successivo, angolo 'a dx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
Gamma2 = 90-Betas/2-F_Delta
--SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- ******************** CHIAMARE QUI FUNZIONE RETTANGOLO ********************************
-- chiamo la funzione per il disegno (senso antiorario) dei lati del rettangolo 'allineato'
local l1, l2, l3, l4 = DrawRectangle (Pz, Lay, BaseL + Delta1 + Delta2 , HeightL, sName, RefToAF, Delta1, Delta2)
-- inserisco gli Id dei lati del rettangolo nel Side_Record in SideTab
SideTab[SideNum].l1 = l1; SideTab[SideNum].l2 = l2; SideTab[SideNum].l3 = l3; SideTab[SideNum].l4 = l4
SideAngSetInfo ( l2, LayLbl, Gamma1, dStdOffs, dHLbl)
SideAngSetInfo ( l4, LayLbl, Gamma2, dStdOffs, dHLbl)
-- taglio inclinato a -(45+delta) del lato superiore del frontalino
Gamma = -(45+F_Delta)
SideAngSetInfo ( l1, LayLbl, Gamma, dStdOffs, dHLbl)
SideAngSetInfo ( Tab[N].IdSd, LayLbl, Gamma, dStdOffs, dHLbl)
end --AlZATINE/FRONTALINI
-- ???? prevedere caso di errore (info ~= da 1 e da 2 e non nulla ??????
EgtDeselectAll()
-- inserisco info con riferimento al lato del componente
-- EgtSetInfo( l1, "RifSideId", Tab[N].IdSd) -- |<<<<<<<<<<<<<<<<<< bisogna mettere il nome del lato !!? NICOLA: ho creato un ideintificaticativo univoco <<<<<<<<<<<<<<<<<<<<<<<<<|
end -- richiesta alzatina o frontalini
end --for COSTRUZIONE DELLE FIGURE (rettangoli)
-- **CALCOLO DEGLI SPOSTAMENTI PER EVENTUALI INTERSEZIONI DEI RETTANGOLI RAPPRESENTATIVI DI A/F**
-- ------------------------------------------------------------------------------------
-- |Ipotesi 1|: Non più di due angoli 'a destra' consecutivi
-- |Ipotesi 2|: Nel caso di cui sopra, un solo angolo 'chiuso'
-- |ATTENZIONE| un rettangolo già mosso o che non si può muovere 'indietro' deve essere identificato ??!
SideNum = 1
-- for SideNum = 1 , #SideTab do --#SideTab do
while SideNum <= #SideTab do
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
-- |LEGENDA 2: INTERSEZIONI|
-- a) un solo angolo consecutivo a dx (alpha < 0+eps)
-- a.r) due rettangoli
-- a.r1) un solo rettangolo con il lato compo successivo
-- a.r2) un solo rettangolo con il alto compo precedente
-- b) due angoli successivi a dx (alpha1 e alpha 2 < 0°+eps);
-- (|alpha1 |+|alpha2 |>90°, <<180°)
-- solo rettangoli rN e rN+2
-- b.r1r3) si intersecano i due rettangoli
-- b.r1) rN interseca il lato N+2
-- b.r3) rN+2 nterseca il lato N
-- c) come (b) ma con anche il rettangolo rN+1
-- (rN+1 resta fermo a mano che |alpha1 | o |alpha2 |>90° <= | se si ammette questo caso ?????????|
-- bisogna verificare alpha1 e alpha2 se acuti => caso (a) per rN+1; quindi 'sfilare' rN da RN+1 e rN+2 da rN+1
local Tab = SideTab
local N = SideNum
local epsilon = 0.1 -- costante
--local dOffsR = CMP.BBoxRad*0.1 -- distanza dei rettangoli dal lato corrispondente
local dsp1x -- spostamento (nel verso x+ del proprio sist. di rif.) del rettangolo
local dH1, dH2, dH3 -- altezze dei rettangoli N, N+1, N+2 rispettivamente a seconda se alzatine o frontalini
if Tab[N].InfoSd == 1 then dH1 = AH else dH1 = FH end
if Tab[Tab[N].RecNxt].InfoSd == 1 then dH2 = AH else dH2 = FH end
if Tab[Tab[Tab[N].RecNxt].RecNxt].InfoSd == 1 then dH3 = AH else dH3 = FH end
local Alpha1 = Tab[N].zNxtAng
local Beta1 = 180 + Alpha1
local Alpha2 = Tab[Tab[N].RecNxt].zNxtAng
local Beta2 = 180 + Alpha2
-- **[a]: un solo angolo consecutivo a dx**
if Alpha1 < 0 and Alpha2 > 0 then
local dSp1xa, dSp1xb, dSP2xa, dSp2xb
local dSp1x, dSp2x
-- **[a.r1r2]**: entrambi i lati N e N+1 iunteressati da A/F
if Tab[N].InfoSd > 0 and Tab[Tab[N].RecNxt].InfoSd > 0 then
--calcolo degli spostamenti per rettangolo 1 (lato N)
dSp1xa = -(dOffsR+dH2)/sin(Alpha1)
if abs( Alpha1) >= 90 then
--dSP1xb = -(dOffsR+dH1)*tan(90+Alpha1) + dOffsC*tan(90+Alpha1)
dSP1xb = -(dOffsR+dH1)*tan(90+Alpha1) -- - dOffsC*tan(90+Alpha1)
else
dSP1xb = dOffsR*tan(90+Alpha1) -- + dOffsC*tan(90+Alpha1)
end
if abs( Alpha1) >= 90 then
dSp1x = dSp1xa + dSP1xb + dOffsC
else
dSp1x = dSp1xa - dSP1xb + dOffsC
end
-- calcolo degli spostamenti per rettangolo 2 (lato N+1)
dSp2xb = -(dOffsR+dH1)/sin(Beta1) -- - dOffsR/sin(Beta1)
if abs( Alpha1) >= 90 then
dSp2xa = (dOffsR+dH2)*tan(90+Alpha1) -- + dOffsC*tan(90+Alpha1)
else
dSp2xa = -dOffsR*tan(90+Alpha1) -- - dOffsC*tan(90+Alpha1)
end
local Opz = 1 -- <<<<<<<<<<<<<< OPZIONE PROVA <<<<<<<<<<<<<<<<<<<
-- opzione 1 (massima) per spostamento R2
if Opz == 1 then
if abs( Alpha1) >= 90 then
dSp2x = (dSp2xb + dSp2xa) - dOffsC
else
dSp2x = (dSp2xb - dSp2xa) - dOffsC
end
-- opzione 2 (minima) per spostamento R2
else
if abs( Alpha1) >= 90 then
dSp2x = dSp2xa + dOffsC
else
dSp2x = 0
end
end
if dSp1x ~= 0 then
EgtMoveGroup( Tab[N].IdPz, {dSp1x, 0, 0})
end
if dSP2x ~= 0 then
EgtMoveGroup( Tab[Tab[N].RecNxt].IdPz, {dSp2x, 0, 0})
end
-- **[a.r1]:** solo il lato N interessato da A/F, angolo tra i lati acuto
elseif Tab[N].InfoSd > 0 and Tab[Tab[N].RecNxt].InfoSd == 0
and abs( Alpha1) >= 90 then
dSp1x = -(dOffsR+dH1)*tan(90+Alpha1) + dOffsC
if dSp1x ~= 0 then
EgtMoveGroup( Tab[N].IdPz, {dSp1x, 0, 0})
end
-- **[a.r2]:** solo il lato N+1 interessato da A/F
elseif Tab[N].InfoSd == 0 and Tab[Tab[N].RecNxt].InfoSd > 0
and abs( Alpha1) >= 90 then
dSp2x = (dOffsR+dH2)*tan(90+Alpha1) - dOffsC
if dSP2x ~= 0 then
EgtMoveGroup( Tab[Tab[N].RecNxt].IdPz, {dSp2x, 0, 0})
end
end
SideNum = SideNum + 2
-- **[c]=[b.r1r2r3]:** due angoli consecutivi a dx; tre lati, N, N+1, N+2 interesssati da A/F
-- la somma dei due angoli interni deve essere >= 180°
elseif Alpha1 < 0 and Alpha2 < 0 and
(Tab[N].InfoSd > 0 and Tab[Tab[N].RecNxt].InfoSd > 0 and Tab[Tab[Tab[N].RecNxt].RecNxt].InfoSd > 0 ) then
local dSp1xa, dSp1xb, dSP3xa, dSp3xb
local dSp1x, dSp3x
--calcolo degli spostamenti per rettangolo 1 (lato N)
if abs( Alpha1) <= 90 and abs( Alpha2) <= 90 then
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< QUI <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
dSp1xa = -(dOffsR+dH2)/sin(Alpha1)
dSP1xb = dOffsR*tan(90+Alpha1)
dSp1x = dSp1xa - dSP1xb + dOffsC
dSp3xb = -(dOffsR+dH2)/sin(Beta2) -- - dOffsR/sin(Beta1)
dSp3xa = -dOffsR*tan(90+Alpha1) -- - dOffsC*tan(90+Alpha1)
dSp3x = (dSp3xb - dSp3xa) - dOffsC
if dSp1x ~= 0 then
EgtMoveGroup( Tab[N].IdPz, {dSp1x, 0, 0})
end
if dSP3x ~= 0 then
EgtMoveGroup( Tab[Tab[Tab[N].RecNxt].RecNxt].IdPz, {dSp3x, 0, 0})
end
elseif abs( Alpha1) >= 90 and abs( Alpha3) <= 90 then
CMP.ERR = 1
CMP.MSG = Msg[370].. "da prevedere?"
elseif abs( Alpha1) <= 90 and abs( Alpha3) >= 90 then
CMP.ERR = 2
CMP.MSG = Msg[370].. "da prevedere?"
else
CMP.ERR = 3
CMP.MSG = Msg[370].. "da prevedere?"
end
SideNum = SideNum + 3
else
SideNum = SideNum + 1
end -- [c] = due angoli consecutivi a dx
end -- while /verifica intersezioni)
--[==[ MOVIMENTI
-- calcolo degli spostamenti (lungo i propri lati di riferimento)
-- a) > if a & b & c
-- di r1 rispetto a r2 e a r3 > prendo il maggiore
-- di r3 rispetto a r1 e a r2 > prendo il maggiore
-- poi posso saltare due lati (?) sì se vale l'ipotesi di massimo due angoli a dx
-- b) elseif a & c & not b
-- di r1 rispetto a r3 e ... viceversa (?)
-- poi posso saltare due lati (?) sì se vale l'ipotesi di massimo due angoli a dx
-- c) else if a & not b & not c
-- di r1 rispetto a r2 e ... viceversa (?)
-- ma att.ne !!! potrei comprometere situazioni successive !!!!!!!!!!!!!!
-- else if : potrebbe esserci intersezione del singolo rettangolo con il lato successivo
-- o precedente !!
-- end ??
-- in caso di intersezione (a), devo verificare se R1 può muoversi 'indietro' o meno
-- in caso negativo, dovrà muoversi R2
Alphas = Tab[N].zNxtAng;
-- **[a)dx.ch.] = caso di interferenza con angolo succcessivo 'a dx', 'chiuso'**
if (Tab[N].InfoSd ~= nil and Tab[Tab[N].RecNxt].InfoSd ~= nil) then
-- if angolo precedente 'aperto' then
-- muovo il rettangolo 1
--and Alphas <= -90 then
EgtMove( Tab[N].IdPz, EgtEP(Tab[N].l3))
-- Point3d EgtIP( int nId1, int nId2, Point3d ptNear [, int RefId = nId])
-- bool EgtMove( int nId/s, Vector3d vtMove [, int nRefType = GDB_RT.LOC])
-- else ( angolo precedente 'chiuso
=> devo spostare il rettangolo 2
end
--else if veriifcare interferenza con i lati del compo principale, se c'è un solo rettangolo
]==]
end --function CMP_Draw(bPreview)
_G.CMP_Draw = CMP_Draw
CMP_Draw(true) -- solo per da egtCAM5
EgtZoom(SCE_ZM.ALL)
--EgtSaveFile( )
+389 -257
View File
@@ -18,6 +18,9 @@
-- 3/08/2021 - inserimento info con riferimento al lato del
-- - inizio studio per 'spostamenti'
-- 9/08/2021 - aggiunto PzId in SideRec ('spostando' tutti gli altri campi !)
-- 20/08/2021 - prova calcolo intersezioni con 'pseudorette' dei lati dei rettangoli
-- 23/08/2021 - inizio calcolo spostamenti con trigonometria casi [a.r1r2/r1/r2]
-- 30/08/2021 - caso [b(r1r2r3)]
-- Intestazioni
require( 'EgtBase')
@@ -35,9 +38,9 @@ local RMin = 5
local CMP = {}
-- elenco dei parametri visualizzati nell'interfaccia del programma OMAG-Cut
CMP.A_Height=30
CMP.F_Height=30
CMP.A_DeltaAng=0.5
CMP.A_Height=30 -- altezza delle alzatine
CMP.F_Height=30 -- altezza dei frontalini
CMP.A_DeltaAng=0.5 -- angolo (semiangolo) di incremento per tagli inclinati
CMP.F_DeltaAng=0.5
-- parametri passati da OmagCut
CMP.BBoxRad = 1000
@@ -45,6 +48,25 @@ CMP.HeightText = 100
--
_G.CMP = CMP
-- 2021/08
-- Disegna i lati di un rattangolo dati layer, Punto, base, altezza;
-- 'allineato al sistema di riferimento' =: base parallela al sistema di riferimento dato
-- sarebbe superata dall'uso diretto della funzione di disegno Rettangolo
-- se non servissse distinguare i singoli lati
local function DrawRectangle (Lay, BaseL, HeightL, sName)
local Pt = Point3d(0,0,0)
local l1 = EgtLinePDL( Lay, Pt, 0, BaseL)
--EgtSetName( l1, sName.." l1")
local l2 = EgtLinePDL( Lay, EgtEP( l1), 90, HeightL)
--EgtSetName( l2, sName.." -l2")
local l3 = EgtLinePDL( Lay, EgtEP( l2), 180, BaseL)
--EgtSetName( l3, sName.." -l3")
local l4 = EgtLine( Lay, EgtEP( l3), EgtSP( l1))
--EgtSetName( l4,sName.." -l4")
return l1, l2, l3, l4
end
-- Scrittura info e etichetta con inclinazione dei lati dei rettangoli
local function SideAngSetInfo(SideId, Lay, Gamma, dOffset, dHLbl)
EgtSetInfo( SideId, "SideAng", Gamma) -- -F_Delta?
@@ -57,6 +79,9 @@ end
local function CMP_Draw(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
CMP.ERR = 0
CMP.MSG = ''
-- Assegno l'angolo di incremento per i tagli inclinati
local F_Delta = CMP.F_DeltaAng
local A_Delta = CMP.A_DeltaAng
@@ -66,8 +91,10 @@ local function CMP_Draw(bPreview)
-- Assegno la dimensione di riferimento (=1/10 del 'raggio' della figura)
local dDim = CMP.BBoxRad*0.1
local dHLbl = CMP.HeightText/7.5
local dStdOffs = dDim/2
local dHLbl = CMP.HeightText*0.15
local dStdOffs = dDim*.5 -- vedi etichettatura lati inclinati
local dOffsR = dDim*.4 -- distanziamento dei rettangoli dai lati del componente
local dOffsC = dDim*.25 -- 'costante' aggiuntiva per spostamenti
--
CMP.ERR = 0
CMP.MSG = ''
@@ -141,6 +168,7 @@ local function CMP_Draw(bPreview)
local SideNum =1
-- **COSTRUZIONE DELLA TABELLA DEI LATI DEL COMPONENTE** (es. piano cucina)
-- --------------------------------------------------------------------
--<<<<<<< HEAD
local SideTab = {}
-- -=======
@@ -153,33 +181,25 @@ local function CMP_Draw(bPreview)
local InfoAF = EgtGetInfo( CurrSide, "AF", 'i')
-- se primo lato
if SideNum == 1 then
--[[ **LEGENDA per campi di SideTab - SUPERATA**
-- .**a = SideId; .b = SideInfo-A/F; c= PrecSideInfo, .d = ProxSideInfo;**
-- **.l1---.l4 = Rectangle sides**
-- **.u = SideStartVector; .v = SideEndVector;**
-- **.g = PrecSideEndvector; .h = ProxSideStartVector;**
-- **.y = PrecSide-Side_Angle; .z = Side-ProxSide_Angle.** ]]
-- |LEGENDA per campi di SideTab|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|
-- |.RecPr = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start VectE; .Ve = Side End Vector;|
-- |LEGENDA 1: campi di SideTab|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
SideRec = {IdSd = CurrSide, IdPz = nil, InfoSd = InfoAF, RecPe = 0, RecNxt = SideNum+1,
SideRec = {IdSd = CurrSide, IdPz = nil, InfoSd = InfoAF, RecPrv = 0, RecNxt = SideNum+1,
VectS = EgtSV(CurrSide), VectE = EgtEV(CurrSide) }
-- se lato successivo al primo
else
local v1 = SideTab[SideNum-1].v
local v1 = SideTab[SideNum-1].VectE
local v2 = EgtSV(CurrSide)
local angv1v2 = atan2( (v1^v2)*Z_AX(),v1*v2)
SideRec = { IdSd = CurrSide, IdPz = nil, InfoSd = InfoAF, RecPr = SideNum-1, RecNxt = SideNum+1,
VectS = EgtSV(CurrSide), VevctE = EgtEV(CurrSide),
zPrvAng = angv1v2 }
local Angv1v2 = atan2( (v1^v2)*Z_AX(),v1*v2)
SideRec = { IdSd = CurrSide, IdPz = nil, InfoSd = InfoAF, RecPrv = SideNum-1, RecNxt = SideNum+1,
VectS = EgtSV(CurrSide), VectE = EgtEV(CurrSide),
zPrvAng = Angv1v2 }
-- completo record precedente
SideTab[SideNum-1].zNxtAng = angv1v2
SideTab[SideNum-1].zNxtAng = Angv1v2
end
-- (per visualizzazione in OmagCUT)
@@ -201,352 +221,464 @@ local function CMP_Draw(bPreview)
end --while
-- completo la tabella con i riferimenti tra ultimo lato e primo (in quanto successivo all'ultimo)
-- |(ripeti LEGENDA per campi di SideTab)||
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|
-- |.RecPr = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start VectE; .Ve = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
-- |(ripeti LEGENDA 1: campi di SideTab)||
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
if #SideTab > 1 then
local v1 = SideTab[#SideTab].zPrvAng
local v2 = SideTab[1].zNxtAng
local v1 = SideTab[#SideTab].VectE
local v2 = SideTab[1].VectS
local Angv1v2 = atan2( (v1^v2)*Z_AX(),v1*v2)
SideTab[#SideTab].NextRec = 1
SideTab[1].PrevRec = #SideTab
SideTab[#SideTab].RecNxt = 1
SideTab[1].RecPrv = #SideTab
SideTab[#SideTab].zNxtAng = Angv1v2
SideTab[1].zPrvAng = Angv1v2
end
-- restituisco un messaggio al programma OMAG-Cut
-- restituisco un messaggio al programma OmagCUT
CMP.MSG = sMsg
-- **COSTRUZIONE DELLE FIGURE** (rettangoli) rappresentative di alzatine
-- **COSTRUZIONE DELLE FIGURE** (rettangoli) rappresentative di alzatine o frontalini
-- -------------------------------------------------------------------------------
for SideNum = 1 , #SideTab do
-- |(ripeti LEGENDA per campi di SideTab)||
-- .a = SideId; .b = SideInfo-A/F; c= PrevRec, .d = NextRec; .e = PzId|
-- .l1---.l4 = Rectangle sides|
-- .u = Side Start Vector; .v = Side End Vector;|
-- .y = PrecSide-Side_Angle; .z = Side-ProxSide_Angle.|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|
-- |.RecPr = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start VectE; .Ve = Side End Vector;|
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
-- se è richiesto un'alzatina o un frontalino
if (SideTab[SideNum].InfoSd ~= 0 and SideTab[SideNum].InfoSd ~= nil) then
if SideTab[SideNum].InfoSd > 0 then
--if SideTab[SideNum].InfoSd > 0 then
local Side = SideTab[SideNum].IdSd
local SVect = SideTab[SideNum].VectS
local EVect = SideTab[SideNum].VectE
local Pz; local Lay; local LayLbl; local BaseL; local HeightL
local BaseL; local HeightL
local sName
--local Pt = EgtSP( Side) + VRotated( SVect*dDim, -90)
local Pt = EgtEP( Side) + VRotated( EVect*dOffsR, -90)
local Frame = Frame3d( Pt, -EVect, VRotated(EVect,-90), Vector3d(0,0,1))
local Pz = EgtGroup(GDB_ID.ROOT, Frame, GDB_RT.GLOB) -- nuova parte per alzatina o frontalino
EgtSetName(Pz,"Alz-Front")
SideTab[SideNum].IdPz = Pz
--local Lay = EgtGroup(Pz, Frame, GDB_RT.GLOB) -- layer della figura
local Lay = EgtGroup( Pz) -- layer della figura
EgtSetName(Lay,'OutLoop')
--EgtSetColor(Lay,RED(),100,true)
--local LayLbl = EgtGroup(Pz,GDB_RT.GLOB) -- layer delle etichette
local LayLbl = EgtGroup( Pz) -- layer delle etichette
EgtSetName(LayLbl,'Labels')
-- caso di alzatina
if SideTab[SideNum].InfoSd == 1 then
--Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- nuova parte per alzatina o frontalino
Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.GLOB) -- nuova parte per alzatina o frontalino
Lay = EgtGroup(Pz,GDB_RT.GLOB) -- layer della figura
EgtSetName(Lay,'OutLoop')
EgtSetColor(Lay,RED(),100,true)
LayLbl = EgtGroup(Pz,GDB_RT.GLOB) -- layer delle etichette
--EgtSetColor(LayLbl,BLACK(),100,true)
--Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.GLOB) -- nuova parte per alzatina o frontalino
--Lay = EgtGroup(Pz,GDB_RT.GLOB) -- layer della figura
--EgtSetName(Lay,'OutLoop')
EgtSetColor(Lay,RED(),100,true)
--LayLbl = EgtGroup(Pz,GDB_RT.GLOB) -- layer delle etichette
--EgtSetColor(LayLbl,BLACK(),100,true)
BaseL = EgtCurveLength( Side)
sName = "L"..SideNum.."-A-"
--sName = "L"..SideNum.."-A-"
sName = "Side "..SideNum.." -A"
HeightL = AH --(=CMP.A_Heigth)
local Pt = EgtEP( Side) + VRotated( EVect*dDim, -90)
-- ++++++++++++++++++++++++++++++++++
SideTab[SideNum].IdPz = Pz
-- spostare e orientare il suo sistema di riferimento come il lato del compo - invertito -
-- ( ?????? o del primo lato del rettangolo - ex l4 ????????)
--[[ da Egt Wiki:
bool move( Frame3d frRef, Vector3d Vm)
Traslazione ( frRef:move( Vm))
bool rotate( Frame3d frRef, Point3d PAx, Vector3d vVx, num dAngDeg)
Rotazione attorno ad un asse ( frRef:rotate(PAx, vAx, dAngDeg), ...)
]]
-- -----------------------------------
-- caso di frontalino
elseif SideTab[SideNum].b == 2 then
Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.GLOB) -- nuova parte per alzatina o frontalino
Lay = EgtGroup(Pz,GDB_RT.GLOB) -- layer della figura
EgtSetName(Lay,'OutLoop')
EgtSetColor(Lay,GREEN(),100,true) -- Ok=1
LayLbl = EgtGroup(Pz,GDB_RT.GLOB) -- layer delle etichette
--EgtSetColor(LayLbl,BLACK(),100,true)
elseif SideTab[SideNum].InfoSd == 2 then
--Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.GLOB) -- nuova parte per alzatina o frontalino
--Lay = EgtGroup(Pz,GDB_RT.GLOB) -- layer della figura
--EgtSetName(Lay,'OutLoop')
EgtSetColor(Lay,GREEN(),100,true) -- Ok=1
--LayLbl = EgtGroup(Pz,GDB_RT.GLOB) -- layer delle etichette
--EgtSetColor(LayLbl,BLACK(),100,true)
BaseL = EgtCurveLength( Side)
sName = "L"..SideNum.."-F-"
--sName = "L"..SideNum.."-F-"
sName = "Side "..SideNum.." -F"
HeightL = FH --(=CMP.F_Heigth)
SideTab[SideNum].Frame = Frame --**?????????????????***** anche QUI *??????????????<<<<<<
end
--local Pt = EgtSP( Side) + VRotated( SVect*dDim, -90)
-- chiamo la funzione per il disegno del rettangolo (Lay, Pt, Base, Altezza, Vettore direz. iniziale, prefisso per nome lati)
local l1, l2, l3, l4 = DrawRect (Lay, Pt, BaseL, HeightL, SVect, sName)
-- chiamo la funzione per il disegno (senso antiorario) dei lati del rettangolo 'allineato'
-- (Layer, Base, Altezza, prefisso per nome lati, )
local l1, l2, l3, l4 = DrawRectangle (Lay, BaseL, HeightL, sName)
EgtSetName( l1,sName.." -l1")
EgtSetName( l2,sName.." -l2")
EgtSetName( l3,sName.." -l3")
EgtSetName( l4,sName.." -l4")
local RectContour = EgtCurveCompo(Lay,{l1,l2,l3,l4},false)
-- inserisco gli Id dei lati del rettangolo nel Side_Record in SideTab
SideTab[SideNum].l1 = l1; SideTab[SideNum].l2 = l2; SideTab[SideNum].l3 = l3; SideTab[SideNum].l4 = l4
-- --------------------------
--SideTab[SideNum].RContour = RectContour
-- **INFO PER TAGLI INCLINATI**
-- --------------------------
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
local Tab = SideTab
local N = SideNum
local Alphap = Tab[N].y;
local Betap
local Alphap; local Alphas
local Betap; local Betas
-- angoli tra lato precedente e attuale
Alphap = Tab[N].zPrvAng;
if Alphap >= 0 then
Betap = 180-Alphap
else
Betap = (180+Alphap)
end
-- angoli tra lato attuale e successivo
local Alphas = Tab[N].z;
Alphas = Tab[N].zNxtAng;
if Alphas >= 0 then
Betas = 180-Alphas
else
Betas = (180+Alphas)
end
local Gamma -- angolo di taglio da calcolare
-- **ALZATINE**
if Tab[N].b == 1 then
if Tab[N].InfoSd == 1 then
-- CASI RIFERITI AL LATO PRECEDENTE
-- |(ripeti LEGENDA per campi di SideTab)||
-- |.a = SideId; .b = SideInfo-A/F; c= PrevRec, .d = NextRec;|
-- |.l1---.l4 = Rectangle sides|
-- |.u = Side Start Vector; .v = Side End Vector;|
-- |.y = PrecSide-Side_Angle; .z = Side-ProxSide_Angle.|
-- **1) Ap0.sx** = non continua da lato precedente, angolo 'a sx'
if (Tab[N].b ~= Tab[Tab[N].c].b) and Alphap > 0 then
if (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
Gamma = Betap-90
SideAngSetInfo ( l1, LayLbl, Gamma, dStdOffs, dHLbl)
SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso **p0.sx.2** = Alphap <= 90, non si fa taglio inclinato)
-- **2) Ap0.dx** = non continua da lato precedente, angolo 'a dx'
elseif (Tab[N].b ~= Tab[Tab[N].c].b) and Alphap < 0 then
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
Gamma = 90 - Betap -- meno F_Delta ???????
SideAngSetInfo ( l1, LayLbl, Gamma, dStdOffs, dHLbl)
SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- **3) Ap1.sx** = continua da lato precedente, angolo 'a sx'
elseif (Tab[N].b == Tab[Tab[N].c].b) and Alphap > 0 then
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
Gamma = -(90-Betap/2+F_Delta)
SideAngSetInfo ( l1, LayLbl, Gamma, dStdOffs, dHLbl)
SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) Ap1.dx** = continua da lato precedente, angolo 'a dx'
elseif (Tab[N].b == Tab[Tab[N].c].b) and Alphap < 0 then
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
Gamma = -(90-Betap/2-F_Delta)
SideAngSetInfo ( l1, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- CASI RIFERITI AL LATO SUCCESSIVO
-- **1) As0.sx** = non continua al lato successivo, angolo 'a sx'
if (Tab[N].b ~= Tab[Tab[N].d].b) and Alphas > 0 then
Gamma = Betas-90 -- meno F_Delta ???
SideAngSetInfo ( l3, LayLbl, Gamma, dStdOffs, dHLbl)
-- **2) As0.dx** = non continua al lato successivo, angolo 'a dx'
elseif (Tab[N].b ~= Tab[Tab[N].d].b) and Alphas < 0 then
Gamma = 90-Betas -- meno F_Delta ???
SideAngSetInfo ( l3, LayLbl, Gamma, dStdOffs, dHLbl)
-- **3) As1.sx** = continua al lato successivo, angolo 'a sx'
elseif (Tab[N].b == Tab[Tab[N].d].b) and Alphas > 0 then
Gamma = -(90-Betas/2+F_Delta)
SideAngSetInfo ( l3, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) As1.dx** = continua al lato successivo, angolo 'a dx'
elseif (Tab[N].b == Tab[Tab[N].d].b) and Alphas < 0 then
Gamma = 90-Betas/2-F_Delta
SideAngSetInfo ( l3, LayLbl, Gamma, dStdOffs, dHLbl)
SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- CASI RIFERITI AL LATO SUCCESSIVO
-- **1) As0.sx** = non continua al lato successivo, angolo 'a sx'
if (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
Gamma = Betas-90 -- meno F_Delta ???
SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **2) As0.dx** = non continua al lato successivo, angolo 'a dx'
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
Gamma = 90-Betas -- meno F_Delta ???
SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **3) As1.sx** = continua al lato successivo, angolo 'a sx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
Gamma = -(90-Betas/2+F_Delta)
SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) As1.dx** = continua al lato successivo, angolo 'a dx'
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
Gamma = 90-Betas/2-F_Delta
SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **FRONTALINI**
elseif Tab[N].b == 2 then
-- |(ripeti LEGENDA per campi di SideTab)||
-- |.a = SideId; .b = SideInfo-A/F; c= PrevRec, .d = NextRec;|
-- |.l1---.l4 = Rectangle sides|
-- |.u = Side Start Vector; .v = Side End Vector;|
-- |.y = PrecSide-Side_Angle; .z = Side-ProxSide_Angle.|
-- **1) Ap0.sx** = non continua da lato precedente, angolo 'a sx'
elseif Tab[N].InfoSd == 2 then
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
-- CASI RIFERITI AL LATO PRECEDENTE
-- **1) Fp0.sx** = non continua da lato precedente, angolo 'a sx'
if (Tab[N].b ~= Tab[Tab[N].c].b) and Alphap > 0 then
if (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
if Alphap > 90 then
Gamma = -(90-Betap) -- meno F_Delta ????
SideAngSetInfo ( l1, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso Alphap <= 90, non si fa taglio inclinato) |>>>> indicare comunque angolo pari a 'zero'? <<<<<<|
SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso Alphap <= 90, non si fa taglio inclinato)
else
Gamma = 0
SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **2) Fp0.dx** = non continua da lato precedente, angolo 'a dx'
elseif (Tab[N].b ~= Tab[Tab[N].c].b) and Alphap < 0 then
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
if -Alphap > 90 then
Gamma = 90-Betap -- meno F_Delta ????
SideAngSetInfo ( l1, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso -Alphap <= 90, non si fa taglio inclinato) |>>>> indicare comunque angolo pari a 'zero'? <<<<<<<<<|
SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso -Alphap <= 90, non si fa taglio inclinato)
else
Gamma = 0
SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **3) Fp1.sx** = continua da lato precedente, angolo 'a sx'
elseif (Tab[N].b == Tab[Tab[N].c].b) and Alphap > 0 then
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap > 0 then
Gamma = -(90-Betap/2+F_Delta)
SideAngSetInfo ( l1, LayLbl, Gamma, dStdOffs, dHLbl)
SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) Fp1.dx** = continua da lato precedente, angolo 'a dx'
elseif (Tab[N].b == Tab[Tab[N].c].b) and Alphap < 0 then
elseif (Tab[N].InfoSd == Tab[Tab[N].RecPrv].InfoSd) and Alphap < 0 then
Gamma = 90-Betap/2-F_Delta
SideAngSetInfo ( l1, LayLbl, Gamma, dStdOffs, dHLbl)
SideAngSetInfo ( l2, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- CASI RIFERITI AL LATO SUCCESSIVO
-- |(ripeti LEGENDA per campi di SideTab)||
-- |.a = SideId; .b = SideInfo-A/F; c= PrevRec, .d = NextRec;|
-- |.l1---.l4 = Rectangle sides|
-- |.u = Side Start Vector; .v = Side End Vector;|
-- |.y = PrecSide-Side_Angle; .z = Side-ProxSide_Angle.|
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
-- **1) Fs0.sx** = non continua al lato successivo, angolo 'a sx'
if (Tab[N].b ~= Tab[Tab[N].d].b) and Alphas > 0 then
if (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
if Alphas > 90 then
Gamma = -(90-Betas) -- meno F_Delta ????
SideAngSetInfo ( l3, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso Alphas <= 90, non si fa taglio inclinato) |<<<<<<<<<<<< indicare comunque angolo pari a 'zero'?|
SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso Alphap <= 90, non si fa taglio inclinato)
else
Gamma = 0
SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **2) Fs0.dx** = non continua al lato successivo, angolo 'a dx'
elseif (Tab[N].b ~= Tab[Tab[N].d].b) and Alphas < 0 then
elseif (Tab[N].InfoSd ~= Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
-- **Fs0.dx.1**
if -Alphas > 90 then
Gamma = 90-Betas -- meno F_Delta ????
SideAngSetInfo ( l3, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso -Alphas <= 90, non si fa taglio inclinato) |<<<<<<<<<<<< indicare comunque angolo pari a 'zero'?|
SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- (in caso -Alphap <= 90, non si fa taglio inclinato)
else
Gamma = 0
SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- **3) Fs1.sx** = continua al lato successivo, angolo 'a sx'
elseif (Tab[N].b == Tab[Tab[N].d].b) and Alphas > 0 then
Gamma = -(90-Betas/2*F_Delta)
SideAngSetInfo ( l3, LayLbl, Gamma, dStdOffs, dHLbl)
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas > 0 then
Gamma = -(90-Betas/2+F_Delta)
SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
-- **4) Fs1.dx** = continua al lato successivo, angolo 'a dx'
elseif (Tab[N].b == Tab[Tab[N].d].b) and Alphas < 0 then
elseif (Tab[N].InfoSd == Tab[Tab[N].RecNxt].InfoSd) and Alphas < 0 then
Gamma = 90-Betas/2-F_Delta
SideAngSetInfo ( l3, LayLbl, Gamma, dStdOffs, dHLbl)
SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
end
-- taglio inclinato a -(45+delta) del lato superiore del frontalino
Gamma = -(45+F_Delta)
SideAngSetInfo ( l4, LayLbl, Gamma, dStdOffs, dHLbl)
SideAngSetInfo ( l1, LayLbl, Gamma, dStdOffs, dHLbl)
end --AlZATINE/FRONTALINI
-- ???? prevedere caso di errore (info ~= da 1 e da 2 e non nulla ??????
EgtDeselectAll()
-- inserisco info con riferimento al alto del componente
EgtSetInfo( l4, "RifSideId", Tab[N].a) -- |<<<<<<<<<<<<<<<<<< bisogna mettere il nome del lato !!? <<<<<<<<<<<<<<<<<<<<<<<<<|
-- inserisco info con riferimento al lato del componente
EgtSetInfo( l1, "RifSideId", Tab[N].IdSd) -- |<<<<<<<<<<<<<<<<<< bisogna mettere il nome del lato !!? <<<<<<<<<<<<<<<<<<<<<<<<<|
end -- richiesta alzatina o frontalini
end --for COSTRUZIONE DELLE FIGURE (rettangoli)
--
-- ------------------------------------------------------------------
-- verifica delle **INTERSEZIONI TRA RETTANGOLI** e definizione degli eventuali **SPOSTAMENTI**
for SideNum = 1 , 3 do --#SideTab do
-- |(ripeti LEGENDA per campi di SideTab)|
-- |.a = SideId; .b = SideInfo-A/F; c= PrevRec, .d = NextRec;|
-- |.l1---.l4 = Rectangle sides|
-- |.u = Side Start Vector; .v = Side End Vector;|
-- |.y = PrecSide-Side_Angle; .z = Side-ProxSide_Angle.|
end --for COSTRUZIONE DELLE FIGURE (rettangoli)
-- **CALCOLO DEGLI SPOSTAMENTI PER EVENTUALI INTERSEZIONI DEI RETTANGOLI RAPPRESENTATIVI DI A/F**
-- ------------------------------------------------------------------------------------
-- |Ipotesi 1|: Non più di due angoli 'a destra' consecutivi
-- |Ipotesi 2|: Nel caso di cui sopra, un solo angolo 'chiuso'
-- |ATTENZIONE| un rettangolo già mosso o che non si può muovere 'indietro' deve essere identificato ??!
SideNum = 1
-- for SideNum = 1 , #SideTab do --#SideTab do
while SideNum <= #SideTab do
-- |ripeti LEGENDA 1: campi di SideTab)|
-- |.IdSd = Side_Id; .IdPz = Pz_Id; .Frame = Ref_Id; .InfoSd = SideInfo(Alz/Front);|
-- |.l1---.l4 = Rectangle sides|; |.RContour = contorno del rettengolo|
-- |.RecPrv = Previous Record; RecNxt = Next Record|
-- |.VectS = Side Start; ; .VectE = Side End Vector;|
-- |.zPrvAng = PrecSide-Side_Angle; .zNxtAng = Side-ProxSide_Angle.|
-- |LEGENDA 2: INTERSEZIONI|
-- a) un solo angolo consecutivo a dx (alpha < 0+eps)
-- a.r) due rettangoli
-- a.r1) un solo rettangolo con il lato compo successivo
-- a.r2) un solo rettangolo con il alto compo precedente
-- b) due angoli successivi a dx (alpha1 e alpha 2 < 0°+eps);
-- (|alpha1 |+|alpha2 |>90°, <<180°)
-- solo rettangoli rN e rN+2
-- b.r1r3) si intersecano i due rettangoli
-- b.r1) rN interseca il lato N+2
-- b.r3) rN+2 nterseca il lato N
-- c) come (b) ma con anche il rettangolo rN+1
-- (rN+1 resta fermo a mano che |alpha1 | o |alpha2 |>90° <= | se si ammette questo caso ?????????|
-- bisogna verificare alpha1 e alpha2 se acuti => caso (a) per rN+1; quindi 'sfilare' rN da RN+1 e rN+2 da rN+1
local Tab = SideTab
local N = SideNum
local epsilon = 0.1 -- costante
--local dOffsR = CMP.BBoxRad*0.1 -- distanza dei rettangoli dal lato corrispondente
local dsp1x -- spostamento (nel verso x+ del proprio sist. di rif.) del rettangolo
local dH1, dH2, dH3 -- altezze dei rettangoli N, N+1, N+2 rispettivamente a seconda se alzatine o frontalini
if Tab[N].InfoSd == 1 then dH1 = AH else dH1 = FH end
if Tab[Tab[N].RecNxt].InfoSd == 1 then dH2 = AH else dH2 = FH end
if Tab[Tab[Tab[N].RecNxt].RecNxt].InfoSd == 1 then dH3 = AH else dH3 = FH end
local Alpha1 = Tab[N].zNxtAng
local Beta1 = 180 + Alpha1
local Alpha2 = Tab[Tab[N].RecNxt].zNxtAng
local Beta2 = 180 + Alpha2
-- **[a]: un solo angolo consecutivo a dx**
if Alpha1 < 0 and Alpha2 > 0 then
local dL1xa, dL1xb, dSP2xa, dSp2xb
local dSp1x, dSp2x
-- **[a.r1r2]**: entrambi i lati N e N+1 iunteressati da A/F
if Tab[N].InfoSd > 0 and Tab[Tab[N].RecNxt].InfoSd > 0 then
--calcolo degli spostamenti per rettangolo 1 (lato N)
dL1xa = -(dOffsR+dH2)/sin(Alpha1)
if abs( Alpha1) >= 90 then
--dL1xb = -(dOffsR+dH1)*tan(90+Alpha1) + dOffsC*tan(90+Alpha1)
dL1xb = -(dOffsR+dH1)*tan(90+Alpha1) -- - dOffsC*tan(90+Alpha1)
else
dL1xb = dOffsR*tan(90+Alpha1) -- + dOffsC*tan(90+Alpha1)
end
if abs( Alpha1) >= 90 then
dSp1x = dL1xa + dL1xb + dOffsC
else
dSp1x = dL1xa - dL1xb + dOffsC
end
-- calcolo degli spostamenti per rettangolo 2 (lato N+1)
dL2xb = (dOffsR+dH1)/sin(Beta1) -- - dOffsR/sin(Beta1)
if abs( Alpha1) >= 90 then
dL2xa = -(dOffsR+dH2)*tan(90+Alpha1) -- + dOffsC*tan(90+Alpha1)
else
dL2xa = (dOffsR)*tan(90+Alpha1) -- - dOffsC*tan(90+Alpha1)
end
local Opz = 1 -- <<<<<<<<<<<<<< OPZIONE PROVA <<<<<<<<<<<<<<<<<<<
-- opzione 1 (massima) per spostamento R2
if Opz == 1 then
if abs( Alpha1) >= 90 then
dSp2x = -(dL2xb + dL2xa) - dOffsC
else
dSp2x = -(dL2xb - dL2xa) - dOffsC
end
-- opzione 2 (minima) per spostamento R2
else
if abs( Alpha1) >= 90 then
dSp2x = -(dL2xa + dOffsC)
else
dSp2x = 0
end
end
if dSp1x ~= 0 then
EgtMoveGroup( Tab[N].IdPz, {dSp1x, 0, 0})
end
if dSP2x ~= 0 then
EgtMoveGroup( Tab[Tab[N].RecNxt].IdPz, {dSp2x, 0, 0})
end
-- **[a.r1]:** solo il lato N interessato da A/F, angolo tra i lati acuto
-- <<<<<<<<<<<<<<<<< QUI <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-- controllare i segni
elseif Tab[N].InfoSd > 0 and Tab[Tab[N].RecNxt].InfoSd == 0
and abs( Alpha1) >= 90 then
dSp1x = -(dOffsR+dH1)*tan(90+Alpha1) + dOffsC
if dSp1x ~= 0 then
EgtMoveGroup( Tab[N].IdPz, {dSp1x, 0, 0})
end
-- **[a.r2]:** solo il lato N+1 interessato da A/F
elseif Tab[N].InfoSd == 0 and Tab[Tab[N].RecNxt].InfoSd > 0
and abs( Alpha1) >= 90 then
dSp2x = (dOffsR+dH2)*tan(90+Alpha1) - dOffsC
if dSP2x ~= 0 then
EgtMoveGroup( Tab[Tab[N].RecNxt].IdPz, {dSp2x, 0, 0})
end
end
SideNum = SideNum + 2
-- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-- **[b]=[b.r1r2r3]:** due angoli consecutivi a dx; tre lati, N, N+1, N+2 interesssati da A/F
-- la somma dei due angoli interni deve essere <= 180°
elseif Alpha1 < 0 and Alpha2 < 0 and
(Tab[N].InfoSd > 0 and Tab[Tab[N].RecNxt].InfoSd > 0 and Tab[Tab[Tab[N].RecNxt].RecNxt].InfoSd > 0 ) then
local dL1xa, dL1xb, dL3xa, dL3xb
local dSp1x, dSp3x
local Tab = SideTab
local N = SideNum
-- **[b.1]** Angoli Alpha1 e Alpha2 ottusi
if abs( Alpha1) <= 90 and abs( Alpha2) <= 90 then
-- spostamento rettangolo 1
dL1xa = -(dOffsR+dH2)/sin(Alpha1)
dL1xb = dOffsR*tan(90+Alpha1)
dSp1x = dL1xa - dL1xb + dOffsC
if dSp1x ~= 0 then
EgtMoveGroup( Tab[N].IdPz, {dSp1x, 0, 0})
end
-- spostamento rettangolo 3
dL3xb = -(dOffsR+dH2)/sin(Beta2) -- - dOffsR/sin(Beta1)
dL3xa = -dOffsR*tan(90+Alpha1) -- - dOffsC*tan(90+Alpha1)
dSp3x = (dL3xb - dL3xa) - dOffsC
if dSP3x ~= 0 then
EgtMoveGroup( Tab[Tab[Tab[N].RecNxt].RecNxt].IdPz, {dSp3x, 0, 0})
end
-- **[b.2]** Alpha1 o Alpha2 acuto
elseif abs( Alpha1) >= 90 and abs( Alpha3) <= 90 then
CMP.ERR = 1
CMP.MSG = Msg[370].. "da prevedere?"
-- **[b.3]**
elseif abs( Alpha1) <= 90 and abs( Alpha3) >= 90 then
CMP.ERR = 2
CMP.MSG = Msg[370].. "da prevedere?"
else
CMP.ERR = 3
CMP.MSG = Msg[370].. "da prevedere?"
end
SideNum = SideNum + 3
-- a) intersezione tra un rettangolo e il successivo
local PtInt12 = EgtIP( Tab[N].l2, Tab[Tab[N].d].l2, EgtEP( Tab[N].l2), GDB_ID.ROOT)
-- b) intersezione tra il rettangolo successivo e il secondo successivo
local PtInt23 = EgtIP( Tab[Tab[N].d].l2, Tab[Tab[Tab[N].d].d].l2, EgtEP( Tab[Tab[N].d].l2), GDB_ID.ROOT)
-- c) intersezione tra un rettangolo e il secondo successivo
local PtInt13 = EgtIP( Tab[N].l2, Tab[Tab[Tab[N].d].d].l2, EgtEP( Tab[N].l2), GDB_ID.ROOT)
-- **[c]:** due angoli consecutivi a dx, ma solo due lati ( o uno solo) N e N+2 interesssati da A/F
-- la somma dei due angoli interni deve essere < 180°
elseif Alpha1 < 0 and Alpha2 < 0 and
(Tab[Tab[N].RecNxt].InfoSd == 0 and (Tab[N].InfoSd > 0 or Tab[Tab[Tab[N].RecNxt].RecNxt].InfoSd > 0 )) then
CMP.ERR = 4
CMP.MSG = Msg[370].. "da prevedere?"
SideNum = SideNum + 3
else
SideNum = SideNum + 1
end -- [a,b,c]
end -- while /verifica intersezioni)
--[==[ MOVIMENTI
-- |ATTENZIONE POSSONO INTERSECARSI ANCHE I LATI 1 E 4 DEI RETTANGOLI !!!|
-- calcolo degli spostamenti (lungo i propri lati di riferimento)
-- if a & b & c
-- a) > if a & b & c
-- di r1 rispetto a r2 e a r3 > prendo il maggiore
-- di r3 rispetto a r1 e a r2 > prendo il maggiore
-- poi posso saltare due lati (?) sì se vale l'ipotesi di massimo due angoli a dx
-- elseif a & c & not b
-- b) elseif a & c & not b
-- di r1 rispetto a r3 e ... viceversa (?)
-- poi posso saltare due lati (?) sì se vale l'ipotesi di massimo due angoli a dx
-- else if a & not b & not c
-- c) else if a & not b & not c
-- di r1 rispetto a r2 e ... viceversa (?)
-- ma att.ne !!! potrei comprometere situazioni successive !!!!!!!!!!!!!!
-- else if : potrebbe esserci intersezione del singolo rettangolo con il lato successivo
-- o precedente !!
-- end ??
-- in caso di intersezione (a), devo verificare se R1 può muoversi 'indietro' o meno
-- in caso negativo, dovrà muoversi R2
-- <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-- PROVA
if PtInt12 then
EgtLinePDL( 2, PtInt12, 30, 100, GDB_RT.GLOB)
local text = "Pt12"
EgtText( 2 , PtInt12, text, 15, GDB_RT.GLOB)
-- int EgtText( int nParentId, Point3d PtIni, string Text, num dH [, int nRefType = GDB_RT.LOC])
Alphas = Tab[N].zNxtAng;
-- **[a)dx.ch.] = caso di interferenza con angolo succcessivo 'a dx', 'chiuso'**
if (Tab[N].InfoSd ~= nil and Tab[Tab[N].RecNxt].InfoSd ~= nil) then
-- if angolo precedente 'aperto' then
-- muovo il rettangolo 1
--and Alphas <= -90 then
EgtMove( Tab[N].IdPz, EgtEP(Tab[N].l3))
-- Point3d EgtIP( int nId1, int nId2, Point3d ptNear [, int RefId = nId])
-- bool EgtMove( int nId/s, Vector3d vtMove [, int nRefType = GDB_RT.LOC])
-- else ( angolo precedente 'chiuso
=> devo spostare il rettangolo 2
end
if PtInt13 then
local text = "Pt13"
EgtText( 2 , PtInt13, text, 15, GDB_RT.GLOB)
EgtLinePDL( 2, PtInt13, 30, 100, GDB_RT.GLOB)
end
if PtInt23 then
local text = "Pt23"
EgtText( 2 , PtInt23, text, 15, GDB_RT.GLOB)
EgtLinePDL( 2, PtInt23, 30, 100, GDB_RT.GLOB)
end
end -- for VERIFICA INTERSEZIONI ...
--[[
l1 = EgtLinePDL( 2, {0,100,0}, 0, 1000)
l2 = EgtLinePDL( 2, {0.,500,0}, -45, 1000)
Pt = EgtIP( l1, l2, {0,500,0})
if Pt then
EgtLine( 2, Pt, {0,0,0})
]]
--else if veriifcare interferenza con i lati del compo principale, se c'è un solo rettangolo
]==]
--[==[
-- Lati
local stdoffset = 1
local LblL1 = AddLabel(Ll,l1,stdoffset,CMP.N3,dim,-90,RED())
-- EgtSetInfo(LblL1,"Var",1)
local LblL4 = AddLabel(Ll,l4,stdoffset,CMP.N4,dim,-90,RED())
--EgtSetInfo(LblL2,"Var",2)
-- Etichetta del centro della figura ( = PUNTO DI INSERIMENTO )
local ln01 = EgtLinePDL(Ll,ptXY0-Vector3d(dim*.25,0,0),0,dim*.5)
local ln02 = EgtLinePDL(Ll,ptXY0-Vector3d(0,dim*.25,0),90,dim*.5)
local ln1 = EgtLinePDL(Ll,ptXY0,45,dim) pt1 = EgtEP(ln1)
local ln2 = EgtLinePDL(Ll,pt1,0,dim)
local lblXY = AddLabel(Ll,ln2,stdoffset,"("..CMP.N1..";"..CMP.N2..")",dim,90,RED())
EgtErase(ln2)
]==]
end --function CMP_Draw(bPreview)
_G.CMP_Draw = CMP_Draw
+26 -3
View File
@@ -5,10 +5,10 @@ local EgtCompo = {}
print( 'EgtCompo Carlo started')
--[[
-- 2021/07
-- Disegna un rattangolo dati layer, Punto, base, altezza e versore (direzione) della base
-- e con opzione per esploderlo o meno
function DrawRect (Lay, Pt, BaseL, HeightL, Vect, sName)
-- Disegna i lati di un rattangolo 'allineato' dati layer, Punto, base, altezza e versore (direzione) della base
function DrawRectAll (Lay, Pt, BaseL, HeightL, Vect, sName)
local l1 = EgtLinePVL( Lay,Pt,VRotated( Vect,-90),HeightL)
EgtSetName( l1,sName.."l1")
local l2 = EgtLinePVL( Lay,EgtEP( l1),Vect,BaseL)
@@ -19,6 +19,29 @@ function DrawRect (Lay, Pt, BaseL, HeightL, Vect, sName)
EgtSetName( l4,sName.."l4")
return l1, l2, l3, l4
end
]]
--[[ 2021/08
-- Disegna i lati di un rattangolo dati layer, Punto, base, altezza;
-- 'allineato al sistema di riferimento' =: base parallela al sistema di riferimento dato
-- sarebbe superata dall'uso diretto della funzione di disegno Rettangolo
-- se non servissse distinguare i singoli lati
-- |funzione per ora trasferita all'interno di Alz&Front.lua|
function DrawRectangle (Lay, BaseL, HeightL, sName)
local Pt = Point3d(0,0,0)
local l1 = EgtLinePDL( Lay, Pt, 0, BaseL)
--EgtSetName( l1, sName.." l1")
local l2 = EgtLinePDL( Lay, EgtEP( l1), 90, HeightL)
--EgtSetName( l2, sName.." -l2")
local l3 = EgtLinePDL( Lay, EgtEP( l2), 180, BaseL)
--EgtSetName( l3, sName.." -l3")
local l4 = EgtLine( Lay, EgtEP( l3), EgtSP( l1))
--EgtSetName( l4,sName.." -l4")
return l1, l2, l3, l4
end
]]
-- Restituisce l'angolo interno di due lati consecutivi di un poligono
function GetAngIntPol (l1,l2)
+182
View File
@@ -0,0 +1,182 @@
-- 2016/10/21
-- PBagnoRett dati base e altezza
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false )
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
require( 'EgtCompo')
-- Valori limite
local LgMin = 10
-- Parametri : dichiarazione e valori standard
local CMP = {}
CMP.N1 = 'L'
CMP.T1 = 3 -- 0=null, 1=bool, 2=int, 3=len, 4=num, 5=string
CMP.V1 = 800.
CMP.N2 = 'H'
CMP.T2 = 3
CMP.V2 = 600.
CMP.Npar = 2
CMP.Nome = 'PBagnoRett'
CMP.INFO = nil
CMP.WithInt = true
_G.CMP = CMP
-- Aggiorno con ultimi valori salvati (se presenti)
CMP.DATA = EgtGetSourceDir() .. CMP.Nome ..'.dat'
LoadCompoData()
-- Funzione di disegno
local function CMP_Draw(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
-- Assegno le dimensioni
local L = CMP.V1
local H = CMP.V2
CMP.ERR = 0
CMP.MSG = ''
-- Verifica della dimensioni
if L < LgMin then
L = LgMin
CMP.ERR = 1
CMP.MSG = Msg[2]..GetLenLimit(LgMin) -- La lunghezza dei lati deve essere maggiore di
elseif H < LgMin then
H = LgMin
CMP.ERR = 2
CMP.MSG = Msg[2]..GetLenLimit(LgMin) -- La lunghezza dei lati deve essere maggiore di
end
if not bPreview and CMP.ERR ~= 0 then
return
end
-- Se Preview cancello tutto
if bPreview then
EgtNewFile()
EgtSetDefaultMaterial( BLACK())
end
-- Pezzo e Layer
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- pezzo
local Ly = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
EgtSetName(Ly,'OutLoop')
local Lr = EgtGroup(Pz,GDB_RT.LOC) -- layer regione
EgtSetName(Lr,'Region')
local Lc = EgtGroup(Pz,GDB_RT.LOC) -- layer di costruzione
local La = EgtGroup(Pz,GDB_RT.LOC) -- layer ausiliario (diagonali ausiliarie e relative etichette, assi)
EgtSetName(La,"LayAux")
local Le = EgtGroup(Pz,GDB_RT.LOC) -- layer delle etichette pezzo
EgtSetName(Le,"Etichette")
local Lq = EgtGroup(Pz,GDB_RT.LOC) -- layer delle linee di quotatura
EgtSetName(Lq,"Quotature")
EgtSetCurrPartLayer(Pz,Ly)
-- Costruzione della figura: lati
local l1 = EgtLine(Ly,Point3d(0,0,0),Point3d(L,0,0))
EgtSetName(l1,"A1")
local l2 = EgtLine(Ly,EgtEP(l1),Point3d(L,H,0))
EgtSetName(l2,"A2")
local l3 = EgtLine(Ly,EgtEP(l2),Point3d(0,H,0))
EgtSetName(l3,"A3")
local l4 = EgtLine(Ly,EgtEP(l3),EgtSP(l1))
EgtSetName(l4,"A4")
-- assi
local a1 = EgtLinePDL(La,EgtMP(l2),180,L)
local a2 = EgtLinePDL(La,EgtMP(l3),-90,H)
local d1, D1
if CMP.ERR == 0 then
d1 = EgtLine(La,EgtSP(l1),EgtSP(l3))
D1 = (EgtCurveLength(d1))
end
-- Riempimento del rettangolo
local e1 = EgtCurveCompo(Ly,{l1,l2,l3,l4},false)
local s1 = EgtSurfFlatRegion(Lr,e1)
if CMP.ERR == 0 then
EgtSetColor(s1,AQUA())
else
EgtSetColor(s1,ORANGE())
end
EgtSetAlpha(s1,25)
EgtErase(e1)
-- Dimensioni dell'oggetto
local bbox = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD)
local dimX = EgtToUiUnits(bbox:getDimX())
local dimY = EgtToUiUnits(bbox:getDimY())
local dim = bbox:getRadius() * 0.1
local pVal= bbox:getMin() - Vector3d(0,dim*2.8,0)
if CMP.ERR == 0 then
CMP.MSG = Msg[1] .. EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
end
-- Dimensioni sull'oggetto
local ptP = 0.5 * ( bbox:getMin() + bbox:getMax())
local sDim = ''
if CMP.INFO then
sDim = sDim .. CMP.INFO
if ( min( dimX, dimY) / max( dimX, dimY)) > 0.3 then
sDim = sDim .. '<br/>'
else
sDim = sDim .. ' '
end
end
sDim = sDim .. EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
local dDim = bbox:getRadius() * 0.1
local dRot = 0
if dimY > dimX then
dRot = 90
end
local LbOn = AddLabelPnt(Lr,ptP,sDim,dDim,dRot,BLACK())
EgtSetStatus(LbOn,GDB_ST.OFF)
-- Etichette sulla fgure
local stdoffset = 1.2
--local sL = CMP.N1 .. '=' .. EgtNumToString(EgtToUiUnits(L),2)
local sL = CMP.N1
local v1 = AddLabel(Le,l1,stdoffset,sL,dim,-90,RED())
EgtSetInfo(v1,"Var",1)
--local sH = CMP.N2 .. '=' .. EgtNumToString(EgtToUiUnits(H),2)
local sH = CMP.N2
local v2 = AddLabel(Le,l2,stdoffset,sH,dim,-90,RED())
EgtSetInfo(v2,"Var",2)
if CMP.ERR == 0 then
local LblD1 = AddLabelAl(La,d1,stdoffset*.75,'D',dim*.5,90,GREEN())
end
-- Etichette sotto la figura
if CMP.ERR == 0 then
local lLenD1 = EgtToUiUnits(D1)
local sLenD1 = EgtNumToString(lLenD1,1)
local ValD1 = EgtTextAdv(La,pVal,0,'D='..sLenD1,'',100,'S',dim*.5,1,0,GDB_TI.BL)
EgtSetColor(ValD1,GREEN())
EgtSetStatus(ValD1,GDB_ST.SEL)
local dD1Len = (EgtEP(ValD1)-EgtSP(ValD1)):getX() + dim/2
pVal = pVal + Vector3d(dD1Len,0,0)
end
-- Se non Preview
if not bPreview then
-- cancello le parti ausiliarie
EgtErase({La,Le,Lc,Lq})
-- rendo visibile label sul pezzo
EgtSetStatus(LbOn,GDB_ST.ON)
end
-- Se ok
if CMP.ERR == 0 then
-- scrivo i parametri nelle info del pezzo
WriteCompoDataToPart( Pz, CMP.Nome, CMP.Npar)
-- salvo i parametri come nuovo default
SaveCompoData( CMP.Npar)
end
return
end
_G.CMP_Draw = CMP_Draw
+6
View File
@@ -0,0 +1,6 @@
CMP.V1=1800
CMP.V2=2000
CMP.V3=600
CMP.V4=650
CMP.V5=false
CMP.V6=false
+268
View File
@@ -0,0 +1,268 @@
-- 2015/09/__
-- PIANO CUCINA A 'L' AD ANGOLO RETTO
-- Intestazioni
require('EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
require( 'EgtCompo')
-- Valori limite
local LgMin = 10
local AngMin =15
local AngMax = 180 - 1
-- Parametri : dichiarazione e valori standard
--.T (tipo) : 0=null, 1=bool, 2=int, 3=len, 4=num, 5=string
local CMP = {}
CMP.N1 = 'A' -- lunghezza lungo lato muro 1
CMP.T1 = 3
CMP.V1 = 1800
CMP.N2 = 'B' -- lunghezza lungo lato muro 2
CMP.T2 = 3
CMP.V2 = 2000
CMP.N3 = 'C' -- profondità lato muro 1
CMP.T3 = 3
CMP.V3 = 600
CMP.N4 = 'D' -- profondità lato muro 2
CMP.T4 = 3
CMP.V4 = 650
CMP.N5 = '←→' -- Simmetria dx/sx (false = angolo a sx) )
CMP.T5 = 1
CMP.V5 = false
CMP.N6 = '↑↓' -- Ribaltamento su/giù (true = 'L' capovolta)
CMP.T6 = 1
CMP.V6 = false
CMP.Npar = 6
CMP.Nome = 'PCucinaA1'
CMP.WithInt = true
_G.CMP = CMP
-- Aggiorno con ultimi valori salvati (se presenti)
CMP.DATA = EgtGetSourceDir() .. CMP.Nome ..'.dat'
LoadCompoData()
function CMP_Draw(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
-- Assegnazioni
local L1 = CMP.V1
local L2 = CMP.V2
local L3 = CMP.V3
local L4 = CMP.V4
local Simm = CMP.V5
local Rib = CMP.V6
local L5 = L1 - L4
local L6 = L2- L3
local L5label = 'E' -- lato interno 1
local L6label = 'F' -- lato interno 2
local D1label = 'd' -- diagonale
CMP.ERR = 0
CMP.MSG = ''
--Verifica di compatibilità dei dati di input
if L1 < LgMin then
L1 = LgMin
CMP.ERR = 1
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere maggiori di...
end
if L2 < LgMin then
L2 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 2
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere maggiori di...
end
end
if L3 < LgMin then
L3 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 3
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere maggiori di...
end
end
if L4 < LgMin then
L4 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 4
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere maggiori di...
end
end
if L5 < LgMin then
L5 = LgMin L1 = L4 + L5
if CMP.ERR == 0 then
CMP.ERR = 5
CMP.MSG = Msg[201]..GetLenLimit(LgMin) -- Differenza L1-L4 troppo piccola
end
end
if L6 < LgMin then
L6= LgMin L2 = L3 + L6
if CMP.ERR == 0 then
CMP.ERR = 6
CMP.MSG = Msg[202]..GetLenLimit(LgMin) -- Differenza L2-L3 troppo piccola
end
end
-- Se Preview cancello tutto
if bPreview then
EgtNewFile()
EgtSetDefaultMaterial( BLACK())
end
-- Pezzo e Layer
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- pezzo
local Ly = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
EgtSetName(Ly,'OutLoop')
local Lr = EgtGroup(Pz,GDB_RT.LOC) -- layer regione
EgtSetName(Lr,'Region')
local Lc = EgtGroup(Pz,GDB_RT.LOC) -- layer di costruzione
local La = EgtGroup(Pz,GDB_RT.LOC) -- layer ausiliario (diagonali e relative etichette, assi)
EgtSetName(La,"LayAux")
local Le = EgtGroup(Pz,GDB_RT.LOC) -- layer delle etichette pezzo
EgtSetName(Le,"Etichette")
local Lq = EgtGroup(Pz,GDB_RT.LOC) -- layer delle linee di quotatura
EgtSetName(Lq,"Quotature")
EgtSetCurrPartLayer(Pz,Ly)
-- Costruzione della figura
local l2 = EgtLinePDL(Ly,ORIG(),0,L2)
EgtSetName(l2,"A1")
local l4 = EgtLinePDL(Ly,EgtEP(l2),90,L4)
EgtSetName(l4,"A2")
local l6 = EgtLinePDL(Ly,EgtEP(l4),180,L6)
EgtSetName(l6,"A3")
local l5 = EgtLinePDL(Ly,EgtEP(l6),90,L5)
EgtSetName(l5,"A4")
local l3 = EgtLinePDL(Ly,EgtEP(l5),180,L3)
EgtSetName(l3,"A5")
local l1 = EgtLine(Ly,EgtEP(l3),EgtSP(l2))
EgtSetName(l1,"A6")
-- assi
local a1 = EgtLinePDL(La,EgtMP(l3),-90,L1-L4/2)
local a2 = EgtLinePDL(La,EgtMP(l4),180,L2-L3/2)
local a3 = EgtLine(La,EgtSP(l5),EgtSP(l2))
-- diagonale
local d1, D1
if CMP.ERR == 0 then
d1 = EgtLine(La,EgtEP(l3),EgtEP(l2))
D1 = EgtCurveLength(d1)
end
if Lc then
EgtErase(Lc)
end
-- Riempimento della figura
local e1 = EgtCurveCompo(Ly,{l1,l2,l4,l6,l5,l3},false)
local s1 = EgtSurfFlatRegion(Lr,e1)
if CMP.ERR == 0 then
EgtSetColor(s1,AQUA())
else
EgtSetColor(s1,ORANGE())
end
EgtSetAlpha(s1,25)
EgtErase(e1)
-- Simmetria
if Simm then
EgtMirror({Ly,Lr,La},ORIG(),X_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l4,l6,l5,l3,d1})
EgtSetInfo(La,"SIMM","1")
end
-- Ribaltamento della figura
if Rib then
EgtMirror({Ly,Lr,La,Le},ORIG(),Y_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l4,l6,l5,l3})
EgtSetInfo(La,"RIB","1")
end
EgtReorderCurvesInGroup(Ly,ORIG())
-- Dimensioni dell'oggetto
local bbox = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD)
local dimX = EgtToUiUnits(bbox:getDimX())
local dimY = EgtToUiUnits(bbox:getDimY())
local dim = bbox:getRadius() * 0.1
if CMP.ERR == 0 then
CMP.MSG = Msg[1] .. EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
end
local pVal
if Rib then
pVal= bbox:getMin() - Vector3d(0,dim*3,0) -- (in questo caso rimane invariato)
else
pVal= bbox:getMin() - Vector3d(0,dim*3,0)
end
-- Dimensioni sull'oggetto
local sDim = EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
local dDim = bbox:getRadius() * 0.1
local LbOn
if L1 > L2 then
LbOn = AddLabelPnt(Lr,EgtMP(a1,GDB_ID.ROOT),sDim,dDim,90,BLACK())
else
LbOn = AddLabelPnt(Lr,EgtMP(a2,GDB_ID.ROOT),sDim,dDim,0,BLACK())
end
EgtSetStatus(LbOn,GDB_ST.OFF)
-- Etichette sulla figura
local stdoffset = 1
local LblL1 = AddLabel(Le,l1,stdoffset,CMP.N1,dim,-90,RED())
EgtSetInfo(LblL1,"Var",1)
local LblL2 = AddLabel(Le,l2,stdoffset,CMP.N2,dim,-90,RED())
EgtSetInfo(LblL2,"Var",2)
local LblL3 = AddLabel(Le,l3,stdoffset,CMP.N3,dim,-90,RED())
EgtSetInfo(LblL3,"Var",3)
local LblL4 = AddLabel(Le,l4,stdoffset,CMP.N4,dim,-90,RED())
EgtSetInfo(LblL4,"Var",4)
local LblL5 = AddLabel(Le,l5,stdoffset,L5label,dim,-90,GREEN())
local LblL6 = AddLabel(Le,l6,stdoffset,L6label,dim,-90,GREEN())
local LblD1
if CMP.ERR == 0 then
LblD1 = AddLabelAl(La,d1,stdoffset*.75,D1label,dim/2,90,GREEN())
end
-- Etichette sotto la figura
local lLenL5 = EgtToUiUnits(L5)
local sLenL5 = EgtNumToString(lLenL5,1)
local ValL5 = EgtTextAdv(Le,pVal,0,L5label..'='..sLenL5,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL5,GREEN())
EgtSetStatus(ValL5,GDB_ST.SEL)
local ValL5Len = (EgtEP(ValL5,GDB_RT.GLOB)-EgtSP(ValL5,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL5Len,0,0)
local lLenL6 = EgtToUiUnits(L6)
local sLenL6 = EgtNumToString(lLenL6,1)
local ValL6 = EgtTextAdv(Le,pVal,0,L6label..'='..sLenL6,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL6,GREEN())
EgtSetStatus(ValL6,GDB_ST.SEL)
local ValL6Len = (EgtEP(ValL6,GDB_RT.GLOB)-EgtSP(ValL6,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL6Len,0,0)
if CMP.ERR == 0 then
local lLenD1 = EgtToUiUnits(D1)
local sLenD1 = EgtNumToString(lLenD1,1)
local ValD1 = EgtTextAdv(La,pVal,0,D1label..'='..sLenD1,'',100,'S',dim*.5,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValD1,GREEN())
EgtSetStatus(ValD1,GDB_ST.SEL)
end
-- Se non Preview
if not bPreview then
-- cancello etichette e parti ausiliarie (es.: altezze, diagonali )
EgtErase({La,Le})
-- rendo visibile label sul pezzo
EgtSetStatus(LbOn,GDB_ST.ON)
end
-- Se ok
if CMP.ERR == 0 then
-- scrivo i parametri nelle info del pezzo
WriteCompoDataToPart( Pz, CMP.Nome, CMP.Npar)
-- salvo i parametri come nuovo default
SaveCompoData( CMP.Npar)
end
end
_G.CMP_Draw = CMP_Draw
CMP_Draw(true)
EgtZoom(SCE_ZM.ALL)
+8
View File
@@ -0,0 +1,8 @@
CMP.V1=1800
CMP.V2=2000
CMP.V3=600
CMP.V4=500
CMP.V5=false
CMP.V6=100
CMP.V7=false
CMP.V8=false
+653
View File
@@ -0,0 +1,653 @@
-- 2015/10/__
-- PIANO CUCINA A 'L' AD ANGOLO RETTO CON SMUSSO o RACCORDO
-- Intestazioni
require('EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
require( 'EgtCompo')
local Nome = 'PCucinaA23'
-- Valori limite
local LgMin = 10 -- lati
--local AlfaMin = 60
--local AlfaMax = 150
local RMin = 10
-- Parametri : dichiarazione e valori standard
--.T (tipo) : 0=null, 1=bool, 2=int, 3=len, 4=num, 5=string
local CMP = {}
CMP.N1 = 'A' -- lato lungo muro 'obliquo'
CMP.T1 = 3
CMP.V1 = 1800
CMP.N2 = 'B' -- lato lungo muro 'orizzontale'
CMP.T2 = 3
CMP.V2 = 2000
CMP.N3 = 'C' -- profondità lato 'obliquo'
CMP.T3 = 3
CMP.V3 = 600
CMP.N4 = 'D' -- profondità lato 'orizzontale'
CMP.T4 = 3
CMP.V4 = 500
CMP.N5 = '\\(' --'Ch/Fill' -- opzione smusso interno a 45° / raccordo (true = raccordo)
CMP.T5 = 1
CMP.V5 = false
CMP.N6 = 'G/R' -- lunghezza 'smusso' interno a 45° o raggio di raccordo
CMP.T6 = 3
CMP.V6 = 100
CMP.N7 = '←→' -- Simmetria dx/sx (true = svuotamento a dx)
CMP.T7 = 1
CMP.V7 = false
CMP.N8 = '↑↓' -- Simmetria su/giù ('ribaltamento') (true = 'L' capovolta)
CMP.T8 = 1
CMP.V8 = false
CMP.Npar = 8
CMP.Nome = Nome
CMP.WithInt = true
_G.CMP = CMP
-- Aggiorno con ultimi valori salvati (se presenti)
CMP.DATA = EgtGetSourceDir() .. CMP.Nome ..'.dat'
LoadCompoData()
local function CMP_DrawA2(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
-- Assegnazioni
local L1 = CMP.V1
local L2 = CMP.V2
local L3 = CMP.V3
local L4 = CMP.V4
local Alfa = 90
local L6 = CMP.V6
local Simm = CMP.V7
local Rib = CMP.V8
CMP.N6='G' -- smusso
local L5label = 'E' -- lato 'obliquo' interno
local L7label = 'F' -- lato 'orizzontale' interno
local D1label = 'd' -- diagonale
CMP.ERR = 0
CMP.MSG = ''
--Verifica di compatibilità dei dati di input
if L1 < LgMin then
L1 = LgMin
CMP.ERR = 1
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a ...
end
if L2 < LgMin then
L2 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 2
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
if L3 < LgMin then
L3 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 3
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
if L4 < LgMin then
L4 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 4
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
--[[if Alfa < AlfaMin then
Alfa = AlfaMin
if CMP.ERR == 0 then
CMP.ERR = 5
CMP.MSG = Msg[220]..AlfaMin..' e '..AlfaMax -- L'angolo Alfa deve essere compreso tra ... e ...
end
end
if Alfa > AlfaMax then
Alfa = AlfaMax
if CMP.ERR == 0 then
CMP.ERR = 6
CMP.MSG = Msg[220]..AlfaMin..' e '..AlfaMax -- L'angolo Alfa deve essere compreso tra ... e ...
end
end --]]
if L6 < LgMin then
L6 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 7
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
-- Se Preview cancello tutto
if bPreview then
EgtNewFile()
EgtSetDefaultMaterial( BLACK())
end
-- Pezzo e Layer
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- pezzo
local Ly = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
EgtSetName(Ly,'OutLoop')
local Lr = EgtGroup(Pz,GDB_RT.LOC) -- layer regione
EgtSetName(Lr,'Region')
local Lc = EgtGroup(Pz,GDB_RT.LOC) -- layer di costruzione
local La = EgtGroup(Pz,GDB_RT.LOC) -- layer ausiliario (diagonali e relative etichette, assi)
EgtSetName(La,"LayAux")
local Le = EgtGroup(Pz,GDB_RT.LOC) -- layer delle etichette pezzo
EgtSetName(Le,"Etichette")
local Lq = EgtGroup(Pz,GDB_RT.LOC) -- layer delle linee di quotatura
EgtSetName(Lq,"Quotature")
EgtSetCurrPartLayer(Pz,Ly)
-- Costruzione della figura
local vAlfa = Vector3d (cos(Alfa),sin(Alfa),0)
local l1 = EgtLinePVL(Ly,ORIG(),vAlfa,L1) EgtInvertCurve(l1)
EgtSetName(l1,"A7")
local l2 = EgtLinePDL(Ly,ORIG(),0,L2)
EgtSetName(l2,"A1")
local l3 = EgtLinePVL(Ly,EgtSP(l1),VRotated(vAlfa,-90),L3) EgtInvertCurve(l3)
EgtSetName(l3,"A6")
local l4 = EgtLinePDL(Ly,EgtEP(l2),90,L4)
EgtSetName(l4,"A2")
-- linea di estensione angolo
--local arcAlfa , rrefAlfa
--rrefAlfa = min(L1,L2)/5
--arcAlfa = EgtArcC2P(La,EgtSP(l2),EgtSP(l2)+EgtEV(l2)*rrefAlfa,EgtSP(l1))
-- chiusura dei lati l5 e l7 se possibile
local l5 = EgtLinePVL(Ly,EgtSP(l3),VRotated(vAlfa,180),L1)
EgtInvertCurve(l5)
EgtSetName(l5,"A5")
local l7 = EgtLinePDL(Ly,EgtEP(l4),180,L2)
EgtSetName(l7,"A3")
local Beta, Dist, l6
--if EgtIP(l5,l7,EgtSP(l3)) then
EgtModifyCurveStartPoint(l5,EgtIP(l5,l7,EgtSP(l3)))
EgtModifyCurveEndPoint(l7,EgtIP(l5,l7,EgtEP(l4)))
L5 = EgtCurveLength(l5)
L7 = EgtCurveLength(l7)
-- inserimentp dello smusso se possibile
Beta = (180 - Alfa ) / 2
Dist = L6/2/cos(Beta)
if Dist >= L5 or Dist >= L7 then
Dist = min(L5,L7) - LgMin
if CMP.ERR == 0 then
CMP.ERR = 9
CMP.MSG = Msg[222] -- lo smusso non ci sta : L6 troppo grande
end
end
if Dist > L5-LgMin or Dist > L7-LgMin then
Dist = min(L5,L7) - LgMin
if CMP.ERR == 0 then
CMP.ERR = 10
CMP.MSG = Msg[223]..GetLenLimit(LgMin) -- un lato risulta troppo piccolo (minore di ..)
end
end
--if L7 < LgMin then
-- if CMP.ERR == 0 then
-- CMP.ERR = 11
-- CMP.MSG = Msg[223]..GetLenLimit(LgMin) -- un lato risulta troppo piccolo (minore di ..)
-- end
-- end
l6 = EgtCurveChamfer (Ly,l7,EgtSP(l7),l5,EgtEP(l5),Dist,true)
EgtSetName(l6,"A4")
L5 = EgtCurveLength(l5)
L7 = EgtCurveLength(l7)
--else
-- if CMP.ERR == 0 then
--CMP.ERR = 8
--CMP.MSG = Msg[221] -- figura impossibile: i lati L5 e L7 non si chiudono
--end
--end
-- diagonali e assi di simmetria
local d1, D1, a1, a2
if CMP.ERR == 0 then
d1 = EgtLine(La,EgtSP(l1),EgtEP(l2))
D1 = EgtCurveLength(d1)
a1 = EgtLinePVL(La,EgtMP(l3),VRotated(vAlfa,180),L1)
a2 = EgtLinePDL(La,EgtMP(l4),180,L2)
EgtModifyCurveEndPoint(a1,EgtIP(a1,a2,EgtMP(l6)))
EgtModifyCurveEndPoint(a2,EgtIP(a1,a2,EgtMP(l6)))
end
if Lc then
EgtErase(Lc)
end
-- Riempimento della figura
local e1, s1
if CMP.ERR ~= 8 then
e1 = EgtCurveCompo(Ly,{l1,l2,l4,l7,l6,l5,l3},false)
s1 = EgtSurfFlatRegion(Lr,e1)
if CMP.ERR == 0 then
EgtSetColor(s1,AQUA())
else
EgtSetColor(s1,ORANGE())
end
EgtSetAlpha(s1,25)
EgtErase(e1)
end
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
EgtSetInfo(La,"SIMM","1")
end
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,l7,arcAlfa})
EgtSetInfo(La,"RIB","1")
end
EgtReorderCurvesInGroup(Ly,ORIG())
-- Dimensioni dell'oggetto
local bbox = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD)
local dimX = EgtToUiUnits(bbox:getDimX())
local dimY = EgtToUiUnits(bbox:getDimY())
local dim = bbox:getRadius() * 0.1
if CMP.ERR == 0 then
CMP.MSG = Msg[1] .. EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
end
local pVal
if Rib then
pVal= bbox:getMin() - Vector3d(0,dim*3,0) -- uguali, se non ci sono linee di quotatura sotto la fiura
else
pVal= bbox:getMin() - Vector3d(0,dim*3,0)
end
-- Dimensioni sull'oggetto
local LbOn
if CMP.ERR == 0 then
local sDim = EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
local dDim = bbox:getRadius() * 0.1
if L1 > L2 then
LbOn = AddLabelPnt(Lr,EgtMP(a1,GDB_ID.ROOT),sDim,dDim,90,BLACK())
else
LbOn = AddLabelPnt(Lr,EgtMP(a2,GDB_ID.ROOT),sDim,dDim,0,BLACK())
end
EgtSetStatus(LbOn,GDB_ST.OFF)
end
-- Etichette sulla figura
local stdoffset = 1
local LblL1 = AddLabel(Le,l1,stdoffset,CMP.N1,dim,-90,RED())
EgtSetInfo(LblL1,"Var",1)
local LblL2 = AddLabel(Le,l2,stdoffset,CMP.N2,dim,-90,RED())
EgtSetInfo(LblL2,"Var",2)
local LblL3 = AddLabel(Le,l3,stdoffset,CMP.N3,dim,-90,RED())
EgtSetInfo(LblL3,"Var",3)
local LblL4 = AddLabel(Le,l4,stdoffset,CMP.N4,dim,-90,RED())
EgtSetInfo(LblL4,"Var",4)
--[[local LblAlfa = AddLabel(Le,arcAlfa,stdoffset*.5,CMP.N5,dim*.8,-90,RED())
EgtSetInfo(LblAlfa,"Var",5) --]]
if CMP.ERR ~= 8 then
local LblL6 = AddLabel(Le,l6,stdoffset,CMP.N6,dim,-90,RED())
EgtSetInfo(LblL6,"Var",6)
end
if CMP.ERR == 0 then
local LblL5 = AddLabel(Le,l5,stdoffset,L5label,dim*.75,-90,GREEN())
local LblL7 = AddLabel(Le,l7,stdoffset,L7label,dim*.75,-90,GREEN())
local LblD1 = AddLabelAl(La,d1,stdoffset*.75,D1label,dim/2,90,GREEN())
end
-- Etichette sotto la figura
if CMP.ERR == 0 then
local lLenL5 = EgtToUiUnits(L5)
local sLenL5 = EgtNumToString(lLenL5,1)
local ValL5 = EgtTextAdv(Le,pVal,0,L5label..'='..sLenL5,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL5,GREEN())
EgtSetStatus(ValL5,GDB_ST.SEL)
local ValL5Len = (EgtEP(ValL5,GDB_RT.GLOB)-EgtSP(ValL5,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL5Len,0,0)
local lLenL7 = EgtToUiUnits(L7)
local sLenL7 = EgtNumToString(lLenL7,1)
local ValL7 = EgtTextAdv(Le,pVal,0,L7label..'='..sLenL7,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL7,GREEN())
EgtSetStatus(ValL7,GDB_ST.SEL)
local ValL7Len = (EgtEP(ValL7,GDB_RT.GLOB)-EgtSP(ValL7,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL7Len,0,0)
end
if CMP.ERR == 0 then
local lLenD1 = EgtToUiUnits(D1)
local sLenD1 = EgtNumToString(lLenD1,1)
local ValD1 = EgtTextAdv(La,pVal,0,D1label..'='..sLenD1,'',100,'S',dim*.5,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValD1,GREEN())
EgtSetStatus(ValD1,GDB_ST.SEL)
end
-- Se non Preview
if not bPreview then
-- cancello etichette e parti ausiliarie (es.: altezze, diagonali )
EgtErase({La,Le,Lq})
-- rendo visibile label sul pezzo
EgtSetStatus(LbOn,GDB_ST.ON)
end
-- Se ok
if CMP.ERR == 0 then
-- scrivo i parametri nelle info del pezzo
WriteCompoDataToPart(Pz,CMP.Nome,CMP.Npar)
-- salvo i parametri come nuovo default
SaveCompoData(CMP.Npar)
end
end
function CMP_DrawA3(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
-- Assegnazioni
local L1 = CMP.V1
local L2 = CMP.V2
local L3 = CMP.V3
local L4 = CMP.V4
local Alfa = 90
local R = CMP.V6 -- -- raggio di raccordo tra i lati interni
local Simm = CMP.V7
local Rib = CMP.V8
CMP.N6 = 'R'
local L5label = 'E' -- lato 'obliquo' interno
local L7label = 'F' -- lato 'orizzontale' interno
local D1label = 'd' -- diagonale
CMP.ERR = 0
CMP.MSG = ''
--Verifica di compatibilità dei dati di input
if L1 < LgMin then
L1 = LgMin
CMP.ERR = 1
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a ...
end
if L2 < LgMin then
L2 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 2
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
if L3 < LgMin then
L3 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 3
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
if L4 < LgMin then
L4 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 4
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
--[[if Alfa < AlfaMin then
Alfa = AlfaMin
if CMP.ERR == 0 then
CMP.ERR = 5
CMP.MSG = Msg[220]..AlfaMin..' e '..AlfaMax -- L'angolo Alfa deve essere compreso tra ... e ...
end
end
if Alfa > AlfaMax then
Alfa = AlfaMax
if CMP.ERR == 0 then
CMP.ERR = 6
CMP.MSG = Msg[220]..AlfaMin..' e '..AlfaMax -- L'angolo Alfa deve essere compreso tra ... e ...
end
end --]]
if R < RMin then
R = RMin
if CMP.ERR == 0 then
CMP.ERR = 7
CMP.MSG = Msg[26]..GetLenLimit(RMin) --Il raggio deve essere maggiore o uguale a ..
end
end
-- Se Preview cancello tutto
if bPreview then
EgtNewFile()
EgtSetDefaultMaterial( BLACK())
end
-- Pezzo e Layer
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- pezzo
local Ly = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
EgtSetName(Ly,'OutLoop')
local Lr = EgtGroup(Pz,GDB_RT.LOC) -- layer regione
EgtSetName(Lr,'Region')
local Lc = EgtGroup(Pz,GDB_RT.LOC) -- layer di costruzione
local La = EgtGroup(Pz,GDB_RT.LOC) -- layer ausiliario (diagonali e relative etichette, assi)
EgtSetName(La,"LayAux")
local Le = EgtGroup(Pz,GDB_RT.LOC) -- layer delle etichette pezzo
EgtSetName(Le,"Etichette")
local Lq = EgtGroup(Pz,GDB_RT.LOC) -- layer delle linee di quotatura
EgtSetName(Lq,"Quotature")
EgtSetCurrPartLayer(Pz,Ly)
-- Costruzione della figura
local vAlfa = Vector3d (cos(Alfa),sin(Alfa),0)
local l1 = EgtLinePVL(Ly,ORIG(),vAlfa,L1) EgtInvertCurve(l1)
EgtSetName(l1,"A7")
local l2 = EgtLinePDL(Ly,ORIG(),0,L2)
EgtSetName(l2,"A1")
local l3 = EgtLinePVL(Ly,EgtSP(l1),VRotated(vAlfa,-90),L3) EgtInvertCurve(l3)
EgtSetName(l3,"A6")
local l4 = EgtLinePDL(Ly,EgtEP(l2),90,L4)
EgtSetName(l4,"A2")
--[[ linea di estensione angolo
local arcAlfa , rrefAlfa
rrefAlfa = min(L1,L2)/5
arcAlfa = EgtArcC2P(La,EgtSP(l2),EgtSP(l2)+EgtEV(l2)*rrefAlfa,EgtSP(l1)) --]]
-- chiusura dei lati l5 e l7 se possibile
local l5 = EgtLinePVL(Ly,EgtSP(l3),VRotated(vAlfa,180),L1)
EgtInvertCurve(l5)
EgtSetName(l5,"A5")
local l7 = EgtLinePDL(Ly,EgtEP(l4),180,L2)
EgtSetName(l7,"A3")
local Dist, l6arc, L5, L7
--if EgtIP(l5,l7,EgtSP(l3)) then
EgtModifyCurveStartPoint(l5,EgtIP(l5,l7,EgtSP(l3)))
EgtModifyCurveEndPoint(l7,EgtIP(l5,l7,EgtEP(l4)))
L5 = EgtCurveLength(l5) -- L5'
L7 = EgtCurveLength(l7) -- L7'
-- inserimentp del raccordo se possibile
Dist = R --/tan(Alfa/2)
--if Dist >= L5 or Dist >= L7 then
--Dist = min(L5,L7) - LgMin
--if CMP.ERR == 0 then
--CMP.ERR = 9
--CMP.MSG = Msg[222] -- il raccordo non ci sta : L6 troppo grande
--end
--end --
if Dist > L5-LgMin or Dist > L7-LgMin then
Dist = min(L5-LgMin, L7-LgMin)
R = Dist -- *tan(Alfa/2)
if CMP.ERR == 0 then
CMP.ERR = 10
CMP.MSG = Msg[223]..GetLenLimit(LgMin) -- un lato risulta troppo piccolo (minore di ..)
end
end
l6arc = EgtCurveFillet (Ly,l7,EgtSP(l7),l5,EgtEP(l5),R,true)
EgtSetName(l6arc,"A4")
L5 = EgtCurveLength(l5)
L7 = EgtCurveLength(l7)
--else
-- if CMP.ERR == 0 then
--CMP.ERR = 8
--CMP.MSG = Msg[221] -- figura impossibile: i lati L5 e L7 non si chiudono
--end
--end
-- diagonali e assi di simmetria
local d1, D1, a1, a2
if CMP.ERR == 0 then
d1 = EgtLine(La,EgtSP(l1),EgtEP(l2))
D1 = EgtCurveLength(d1)
a1 = EgtLinePVL(La,EgtMP(l3),VRotated(vAlfa,180),L1)
a2 = EgtLinePDL(La,EgtMP(l4),180,L2)
EgtModifyCurveEndPoint(a1,EgtIP(a1,a2,EgtMP(l6arc)))
EgtModifyCurveEndPoint(a2,EgtIP(a1,a2,EgtMP(l6arc)))
end
-- linee di quota - raggio
local dim = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD):getRadius() * 0.1
local pt = EgtMP(l6arc) local vr = EgtMV(l6arc,Lq) --vr = VRotaded(EgtMV(l3,Lq),90) non può funzionare?
local DimLineR = EgtLine(Lq,pt+VRotated(vr,-90)*dim,pt)
pt = EgtEP(DimLineR) vr = EgtEV(DimLineR)
EgtLinePVL(Lq,pt,VRotated(-vr,-15),dim*.4) -- freccia di quotatura
EgtLinePVL(Lq,pt,VRotated(-vr, 15),dim*.4)
pt = EgtSP(DimLineR)-vr*dim/2 -- linea aux per quotatura
local DimLineRAux = EgtLine(Lq,EgtSP(DimLineR),pt)
if Lc then
EgtErase(Lc)
end
-- Riempimento della figura
local e1, s1
if CMP.ERR ~= 8 then
e1 = EgtCurveCompo(Ly,{l1,l2,l4,l7,l6arc,l5,l3},false)
s1 = EgtSurfFlatRegion(Lr,e1)
if CMP.ERR == 0 then
EgtSetColor(s1,AQUA())
else
EgtSetColor(s1,ORANGE())
end
EgtSetAlpha(s1,25)
EgtErase(e1)
end
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6arc,l7,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
EgtSetInfo(La,"SIMM","1")
end
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6arc,l7,arcAlfa})
EgtSetInfo(La,"RIB","1")
end
EgtReorderCurvesInGroup(Ly,ORIG())
-- Dimensioni dell'oggetto
local bbox = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD)
local dimX = EgtToUiUnits(bbox:getDimX())
local dimY = EgtToUiUnits(bbox:getDimY())
dim = bbox:getRadius() * 0.1
if CMP.ERR == 0 then
CMP.MSG = Msg[1] .. EgtNumToString(dimX,2) .. ' X ' .. EgtNumToString(dimY,2)
end
local pVal
if Rib then
pVal= bbox:getMin() - Vector3d(0,dim*3,0) -- uguali, se non ci sono linee di quotatura sotto la fiura
else
pVal= bbox:getMin() - Vector3d(0,dim*3,0)
end
-- Dimensioni sull'oggetto
local LbOn
if CMP.ERR == 0 then
local sDim = EgtNumToString(dimX,2) .. ' X ' .. EgtNumToString(dimY,2)
local dDim = bbox:getRadius() * 0.1
if L1 > L2 then
LbOn = AddLabelPnt(Lr,EgtMP(a1,GDB_ID.ROOT),sDim,dDim,90,BLACK())
else
LbOn = AddLabelPnt(Lr,EgtMP(a2,GDB_ID.ROOT),sDim,dDim,0,BLACK())
end
EgtSetStatus(LbOn,GDB_ST.OFF)
end
-- Etichette sulla figura
local stdoffset = 1
local LblL1 = AddLabel(Le,l1,stdoffset,CMP.N1,dim,-90,RED())
EgtSetInfo(LblL1,"Var",1)
local LblL2 = AddLabel(Le,l2,stdoffset,CMP.N2,dim,-90,RED())
EgtSetInfo(LblL2,"Var",2)
local LblL3 = AddLabel(Le,l3,stdoffset,CMP.N3,dim,-90,RED())
EgtSetInfo(LblL3,"Var",3)
local LblL4 = AddLabel(Le,l4,stdoffset,CMP.N4,dim,-90,RED())
EgtSetInfo(LblL4,"Var",4)
--[[local LblAlfa = AddLabelU(Le,arcAlfa,1/4,stdoffset*.5,CMP.N5,dim*.8,-90,RED())
EgtSetInfo(LblAlfa,"Var",5) --]]
if CMP.ERR ~= 8 then
local LblLR = AddLabelAl(Le,DimLineRAux,stdoffset*.2,CMP.N6,dim*.8,45,RED())
EgtSetInfo(LblLR,"Var",6)
EgtErase(DimLineRAux)
end
if CMP.ERR == 0 then
local LblL5 = AddLabel(Le,l5,stdoffset,L5label,dim*.75,-90,GREEN())
local LblL7 = AddLabel(Le,l7,stdoffset,L7label,dim*.75,-90,GREEN())
local LblD1 = AddLabelAl(La,d1,stdoffset*.75,D1label,dim/2,90,GREEN())
end
-- Etichette sotto la figura
if CMP.ERR == 0 then
local lLenL5 = EgtToUiUnits(L5)
local sLenL5 = EgtNumToString(lLenL5,1)
local ValL5 = EgtTextAdv(Le,pVal,0,L5label..'='..sLenL5,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL5,GREEN())
EgtSetStatus(ValL5,GDB_ST.SEL)
local ValL5Len = (EgtEP(ValL5,GDB_RT.GLOB)-EgtSP(ValL5,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL5Len,0,0)
local lLenL7 = EgtToUiUnits(L7)
local sLenL7 = EgtNumToString(lLenL7,1)
local ValL7 = EgtTextAdv(Le,pVal,0,L7label..'='..sLenL7,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL7,GREEN())
EgtSetStatus(ValL7,GDB_ST.SEL)
local ValL7Len = (EgtEP(ValL7,GDB_RT.GLOB)-EgtSP(ValL7,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL7Len,0,0)
end
if CMP.ERR == 0 then
local lLenD1 = EgtToUiUnits(D1)
local sLenD1 = EgtNumToString(lLenD1,1)
local ValD1 = EgtTextAdv(La,pVal,0,D1label..'='..sLenD1,'',100,'S',dim*.5,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValD1,GREEN())
EgtSetStatus(ValD1,GDB_ST.SEL)
end
-- Se non Preview
if not bPreview then
-- cancello etichette e parti ausiliarie (es.: altezze, diagonali )
EgtErase({La,Le,Lq})
-- rendo visibile label sul pezzo
EgtSetStatus(LbOn,GDB_ST.ON)
end
-- Se ok
if CMP.ERR == 0 then
-- scrivo i parametri nelle info del pezzo
WriteCompoDataToPart(Pz,CMP.Nome,CMP.Npar)
-- salvo i parametri come nuovo default
SaveCompoData(CMP.Npar)
end
end
function CMP_Draw( bPreview)
local OpzRaccordo = CMP.V5
if OpzRaccordo then
CMP_DrawA3( bPreview)
else
CMP_DrawA2( bPreview)
end
end
_G.CMP_Draw = CMP_Draw
CMP_Draw(true)
EgtZoom(SCE_ZM.ALL)
+7
View File
@@ -0,0 +1,7 @@
CMP.V1=1000
CMP.V2=500
CMP.V3=500
CMP.V4=30
CMP.V5=50
CMP.V6=false
CMP.V7=false
+333
View File
@@ -0,0 +1,333 @@
-- 2015/09/__0
-- PIANO CUCINA CON LAVORAZIONE A RIENTRAARE PER ANGOLO
-- Intestazioni
require('EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
require( 'EgtCompo')
local Nome = 'PCucinaB1'
-- Valori limite
local LgMin = 10 -- lati
local Q1Min = 10 -- profondità di sagomatura del profilo
local RdMin = 10 -- raggio
local AngMin =15
local AngMax = 180 - 1
-- Parametri : dichiarazione e valori standard
--.T (tipo) : 0=null, 1=bool, 2=int, 3=len, 4=num, 5=string
local CMP = {}
CMP.N1 = 'A' -- lato esterno // muro
CMP.T1 = 3
CMP.V1 = 1000
CMP.N2 = 'B' -- profondità
CMP.T2 = 3
CMP.V2 = 500
CMP.N3 = 'C' -- profondità pezzo PCucinaB2
CMP.T3 = 3
CMP.V3 = 500
CMP.N4 = 'Z' -- profondità sagomatura bordo
CMP.T4 = 3
CMP.V4 = 30
CMP.N5 = 'R' -- raggio di raccordo
CMP.T5 = 3
CMP.V5 = 50
CMP.N6 = '←→' -- Simmetria dx/sx (true = svuotamento a dx)
CMP.T6 = 1
CMP.V6 = false
CMP.N7 = '↑↓' -- Simmetria su/giù ('ribaltamento') (true = 'L' capovolta)
CMP.T7 = 1
CMP.V7 = false
CMP.Npar = 7
CMP.Nome = Nome
CMP.WithInt = true
_G.CMP = CMP
-- Aggiorno con ultimi valori salvati (se presenti)
CMP.DATA = EgtGetSourceDir() .. CMP.Nome ..'.dat'
LoadCompoData()
function CMP_Draw(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
-- Assegnazioni
local L1 = CMP.V1
local L2 = CMP.V2
local LC = CMP.V3
local LZ = CMP.V4
local LR = CMP.V5
local Simm = CMP.V6
local Rib = CMP.V7
local K1 = sqrt(2)/2
local Kx = LR*K1
local Ky = LR - LR*K1
local L3 = L1 - LC
local L4 = LZ / K1
local L6 = LC - LZ- Kx
local L7 = L2 -Ky -LZ
local L3label = 'D' -- lato interno // muro
local L6label = 'E' -- lato vs. pezzo PCucinaB2
local L7label = 'F' --
local D1label = 'd' -- diagonale
CMP.ERR = 0
CMP.MSG = ''
--Verifica di compatibilità dei dati di input
if L1 < LgMin then
L1 = LgMin
CMP.ERR = 1
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a ...
end
if L2 < LgMin then
L2 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 2
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
if LC < LgMin then
LC = LgMin
if CMP.ERR == 0 then
CMP.ERR = 3
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
if LZ < Q1Min then
LZ = Q1Min
if CMP.ERR == 0 then
CMP.ERR = 4
CMP.MSG = Msg[205]..GetLenLimit(Q1Min) --La quota Z deve essere > = di...
end
end
if LR < RdMin then
LR = RdMin
if CMP.ERR == 0 then
CMP.ERR = 5
CMP.MSG = Msg[206]..GetLenLimit(RMin) -- Il raggio R deve essere > = RMin
end
end
if L3 < LgMin then
L3 = LgMin L1 = L3 + LC
if CMP.ERR == 0 then
CMP.ERR = 6
CMP.MSG = Msg[207]..GetLenLimit(LgMin) -- Differenza L1-LC troppo piccola
end
end
if L6 < LgMin then
L6 = LgMin LC = L6 + Kx + LZ L1 = LC + L3
if CMP.ERR == 0 then
CMP.ERR = 7
CMP.MSG = Msg[208]..GetLenLimit(LgMin) -- Differenza LC-(Kx+LZ) troppo piccola
end
end
if L7 < LgMin then
L7 = LgMin L2 = L7 + Ky + LZ
if CMP.ERR == 0 then
CMP.ERR = 8
CMP.MSG = Msg[209]..GetLenLimit(LgMin) -- Differenza LC-(Ky+LZ) troppo piccola
end
end
-- Se Preview cancello tutto
if bPreview then
EgtNewFile()
EgtSetDefaultMaterial( BLACK())
end
-- Pezzo e Layer
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- pezzo
local Ly = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
EgtSetName(Ly,'OutLoop')
local Lr = EgtGroup(Pz,GDB_RT.LOC) -- layer regione
EgtSetName(Lr,'Region')
local Lc = EgtGroup(Pz,GDB_RT.LOC) -- layer di costruzione
local La = EgtGroup(Pz,GDB_RT.LOC) -- layer ausiliario (diagonali e relative etichette, assi)
EgtSetName(La,"LayAux")
local Le = EgtGroup(Pz,GDB_RT.LOC) -- layer delle etichette pezzo
EgtSetName(Le,"Etichette")
local Lq = EgtGroup(Pz,GDB_RT.LOC) -- layer delle linee di quotatura
EgtSetName(Lq,"Quotature")
EgtSetCurrPartLayer(Pz,Ly)
-- Costruzione della figura
local l1 = EgtLinePDL(Ly,ORIG(),0,L1)
EgtSetName(l1,"A1")
local l2 = EgtLinePDL(Ly,EgtEP(l1),90,L2)
EgtSetName(l2,"A2")
local l3 = EgtLinePDL(Ly,EgtEP(l2),180,L3)
EgtSetName(l3,"A3")
local l4 = EgtLinePDL(Ly,EgtEP(l3),-135,L4)
local pC = EgtEP(l4) + Vector3d(-1,1,0)*K1*LR -- centro dell'arco di raccordo
local arc = EgtArc(Ly,pC,LR,-45,-45,0) -- arco di raccordo
local l6 = EgtLinePDL(Ly,EgtEP(arc),180,L6)
local l7 = EgtLine(Ly,EgtEP(l6),EgtSP(l1))
EgtSetName(l7,"A4")
-- assi
local a1 = EgtLinePDL(La,EgtMP(l2),180,L1)
local a2 = EgtLine(La,Point3d(LC/2,0,0),Point3d(LC/2,L7,0))
-- diagonale
local d1, D1
if CMP.ERR == 0 then
d1 = EgtLine(La,EgtEP(l7),EgtEP(l2))
D1 = EgtCurveLength(d1)
end
if Lc then
EgtErase(Lc)
end
-- Riempimento della figura
local e1 = EgtCurveCompo(Ly,{l1,l2,l3,l4,arc,l6,l7},false)
local s1 = EgtSurfFlatRegion(Lr,e1)
if CMP.ERR == 0 then
EgtSetColor(s1,AQUA())
else
EgtSetColor(s1,ORANGE())
end
EgtSetAlpha(s1,25)
EgtErase(e1)
local dim = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD):getRadius() * 0.1
-- linee di quotatura
local pt local vr -- generici punto e vettore per costruzione
pt = EgtEP(l2,Lq) + EgtEV(l2,Lq)*dim
local DimLineL3 = EgtLinePDL(Lq,pt,180,L3)
EgtLinePDL(Lq,EgtSP(DimLineL3)-Vector3d(0,dim*.25,0),90,dim*.5) -- trattino di estensione
EgtLinePDL(Lq,EgtEP(DimLineL3)-Vector3d(0,dim*.25,0),90,dim*.5) -- " "
local DimLineLC = EgtLinePDL(Lq,EgtEP(DimLineL3),180,LC)
EgtLinePDL(Lq,EgtSP(DimLineLC)-Vector3d(0,dim*.25,0),90,dim*.5) -- trattino di estensione
EgtLinePDL(Lq,EgtEP(DimLineLC)-Vector3d(0,dim*.25,0),90,dim*.5) -- " "
pt = EgtEP(l3,Lq) + EgtEV(l6,Lq)*(LC+dim)
local DimLineLZ = EgtLinePDL(Lq,pt,-90,LZ)
EgtLinePDL(Lq,EgtSP(DimLineLZ)-Vector3d(dim*.25,0,0),0,dim*.5) -- trattino di estensione
EgtLinePDL(Lq,EgtEP(DimLineLZ)-Vector3d(dim*.25,0,0),0,dim*.5) -- " "
pt = EgtMP(DimLineLZ,Lq)+Vector3d(-dim*.25,0,0)
local lnZ1 = EgtLinePDL(Lq,pt,135,dim*.5) -- trattino per direttrice
local lnZ2 = EgtLinePDL(Lq,EgtEP(lnZ1),90,dim*.5) -- " " "
local DimLineL7 = EgtLinePDL(Lq,EgtEP(DimLineLZ)+Vector3d(0,-Ky,0),-90,L7)
EgtLinePDL(Lq,EgtSP(DimLineL7)-Vector3d(dim*.25,0,0),0,dim*.5) -- trattino di estensione
EgtLinePDL(Lq,EgtEP(DimLineL7)-Vector3d(dim*.25,0,0),0,dim*.5) -- " "
-- raggio
vr = EgtMV(arc,Lq) --vr:rotate(Z_AX(),-90)
local DimLineR1 = EgtLine(Lq,EgtMP(arc)-VRotated(vr,-90)*2*dim,EgtMP(arc))
local DimLineR2 = EgtLine(Lq,EgtMP(arc),EgtMP(arc)+VRotated(vr,-90)*dim)
vr = EgtEV(DimLineR1,Lq) pt = EgtSP(DimLineR1)+vr*dim/2
local DimLineR3 = EgtLinePVL(Lq,pt,VRotated(-vr,90),dim)
--vr:rotate(Z_AX(),-15) EgtLinePVL(Lq,EgtEP(DimLineR1),-vr,10) -- freccia di quotatura
--vr:rotate(Z_AX(), 30) EgtLinePVL(Lq,EgtEP(DimLineR1),-vr,10)
EgtLinePVL(Lq,EgtEP(DimLineR1),VRotated(-vr,-15),dim*.4) -- freccia di quotatura
EgtLinePVL(Lq,EgtEP(DimLineR1),VRotated(-vr, 15),dim*.4)
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,arc,l6,l7,d1})
EgtInvertCurve({DimLineL3,DimLineLC,DimLineLZ,DimLineL7,lnZ2,DimLineR1,DimLineR2,DimLineR3})
EgtSetInfo(La,"SIMM","1")
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,arc,l6,l7})
EgtInvertCurve({DimLineL3,DimLineLC,DimLineLZ,DimLineL7,lnZ2,DimLineR1,DimLineR2})
EgtSetInfo(La,"RIB","1")
end
EgtReorderCurvesInGroup(Ly,ORIG())
-- Dimensioni dell'oggetto
local bbox = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD)
local dimX = EgtToUiUnits(bbox:getDimX())
local dimY = EgtToUiUnits(bbox:getDimY())
dim = bbox:getRadius() * 0.1
if CMP.ERR == 0 then
CMP.MSG = Msg[1] .. EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
end
local pVal
if Rib then
pVal= bbox:getMin() - Vector3d(0,dim*5,0)
else
pVal= bbox:getMin() - Vector3d(0,dim*3,0)
end
-- Dimensioni sull'oggetto
local ptP = 0.5 * ( bbox:getMin() + bbox:getMax())
local sDim = EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
local dDim = bbox:getRadius() * 0.1
local dRot = 0
if dimY > dimX then
dRot = 90
end
local LbOn = AddLabelPnt(Lr,ptP,sDim,dDim,dRot,BLACK())
EgtSetStatus(LbOn,GDB_ST.OFF)
EgtSetStatus(LbOn,GDB_ST.OFF)
-- Etichette sulla figura
local stdoffset = 1
local LblL1 = AddLabel(Le,l1,stdoffset,CMP.N1,dim,-90,RED())
EgtSetInfo(LblL1,"Var",1)
local LblL2 = AddLabel(Le,l2,stdoffset,CMP.N2,dim,-90,RED())
EgtSetInfo(LblL2,"Var",2)
local LblL3 = AddLabel(Le,DimLineL3,stdoffset,L3label,dim*.75,-90,GREEN())
local LblL6 = AddLabel(Le,l6,stdoffset*.75,L6label,dim*.75,-90,GREEN())
local LblLC = AddLabel(Le,DimLineLC,stdoffset,CMP.N3,dim,-90,RED())
EgtSetInfo(LblLC,"Var",3)
local LblLZ = AddLabel(Le,lnZ2,stdoffset*.5,CMP.N4,dim,90,RED())
EgtSetInfo(LblLZ,"Var",4)
EgtErase(lnZ2)
local LblL7 = AddLabel(Le,DimLineL7,stdoffset,L7label,dim*.75,-90,GREEN())
local LblLR = AddLabelAl(Le,DimLineR3,stdoffset*.0,CMP.N5,dim*.8,90,RED())
EgtSetInfo(LblLR,"Var",5)
EgtErase(DimLineR3)
if CMP.ERR == 0 then
LblD1 = AddLabelAl(La,d1,stdoffset*.75,D1label,dim/2,90,GREEN())
end
-- Etichette sotto la figura
local lLenL3 = EgtToUiUnits(L3)
local sLenL3 = EgtNumToString(lLenL3,1)
local ValL3 = EgtTextAdv(Le,pVal,0,L3label..'='..sLenL3,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL3,GREEN())
EgtSetStatus(ValL3,GDB_ST.SEL)
local ValL3Len = (EgtEP(ValL3,GDB_RT.GLOB)-EgtSP(ValL3,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL3Len,0,0)
local lLenL7 = EgtToUiUnits(L7)
local sLenL7 = EgtNumToString(lLenL7,1)
local ValL7 = EgtTextAdv(Le,pVal,0,L7label..'='..sLenL7,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL7,GREEN())
EgtSetStatus(ValL7,GDB_ST.SEL)
local ValL7Len = (EgtEP(ValL7,GDB_RT.GLOB)-EgtSP(ValL7,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL7Len,0,0)
if CMP.ERR == 0 then
local lLenD1 = EgtToUiUnits(D1)
local sLenD1 = EgtNumToString(lLenD1,1)
local ValD1 = EgtTextAdv(La,pVal,0,D1label..'='..sLenD1,'',100,'S',dim*.5,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValD1,GREEN())
EgtSetStatus(ValD1,GDB_ST.SEL)
end
-- Se non Preview
if not bPreview then
-- cancello etichette e parti ausiliarie (es.: altezze, diagonali )
EgtErase({La,Le,Lq})
-- rendo visibile label sul pezzo
EgtSetStatus(LbOn,GDB_ST.ON)
end
-- Se ok
if CMP.ERR == 0 then
-- scrivo i parametri nelle info del pezzo
WriteCompoDataToPart(Pz,CMP.Nome,CMP.Npar)
-- salvo i parametri come nuovo default
SaveCompoData(CMP.Npar)
end
end
_G.CMP_Draw = CMP_Draw
+6
View File
@@ -0,0 +1,6 @@
CMP.V1=800
CMP.V2=500
CMP.V3=30
CMP.V4=50
CMP.V5=false
CMP.V6=false
+290
View File
@@ -0,0 +1,290 @@
-- 2015/10/__
-- PIANO CUCINA CON LAVORAZIONE A A SPORGERE PER ANGOLO
-- Intestazioni
require('EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
require( 'EgtCompo')
local Nome = 'PCucinaB2'
-- Valori limite
local LgMin = 10 -- lati
local Q1Min = 10 -- profondità di sagomatura del profilo
local RdMin = 10 -- raggio
local AngMin =15
local AngMax = 180 - 1
-- Parametri : dichiarazione e valori standard
--.T (tipo) : 0=null, 1=bool, 2=int, 3=len, 4=num, 5=string
local CMP = {}
CMP.N1 = 'A' -- lato lungo muro
CMP.T1 = 3
CMP.V1 = 800
CMP.N2 = 'B' -- profondità lato muro
CMP.T2 = 3
CMP.V2 = 500
CMP.N3 = 'Z' -- profondità sagomatura bordo
CMP.T3 = 3
CMP.V3 = 30
CMP.N4 = 'R' -- raggio di raccordo
CMP.T4 = 3
CMP.V4 = 50
CMP.N5 = '←→' -- Simmetria dx/sx (true = svuotamento a dx)
CMP.T5 = 1
CMP.V5 = false
CMP.N6 = '↑↓' -- Simmetria su/giù ('ribaltamento') (true = 'L' capovolta)
CMP.T6 = 1
CMP.V6 = false
CMP.Npar = 6
CMP.Nome = Nome
CMP.WithInt = true
_G.CMP = CMP
-- Aggiorno con ultimi valori salvati (se presenti)
CMP.DATA = EgtGetSourceDir() .. CMP.Nome ..'.dat'
LoadCompoData()
function CMP_Draw(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
-- Assegnazioni
local L1 = CMP.V1
local L6 = CMP.V2
local LR = CMP.V4
local LZ = CMP.V3
local Simm = CMP.V5
local Rib = CMP.V6
local K1 = sqrt(2)/2
local Kx = LR*K1
local Ky = LR - LR*K1
local L4 = LZ / K1
local L2 = L6 - Kx - LZ
local L5 = L1 - Ky - LZ
local L2label = 'D' -- lato verso pezzo PCucinaB1
local L5label = 'C' -- lunghezza interna lato muro
local D1label = 'd' -- diagonale
CMP.ERR = 0
CMP.MSG = ''
--Verifica di compatibilità dei dati di input
if L1 < LgMin then
L1 = LgMin
CMP.ERR = 1
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a ...
end
if L6 < LgMin then
L6 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 2
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
if LZ < Q1Min then
LZ = Q1Min
if CMP.ERR == 0 then
CMP.ERR = 3
CMP.MSG = Msg[205]..GetLenLimit(Q1Min) --La quota Z deve essere > = di...
end
end
if LR < RdMin then
LR = RdMin
if CMP.ERR == 0 then
CMP.ERR = 4
CMP.MSG = Msg[206]..GetLenLimit(RMin) -- Il raggio R deve essere > = RMin
end
end
if L2 < LgMin then
L2 = LgMin L6 = L2 + Kx + LZ
if CMP.ERR == 0 then
CMP.ERR = 5
CMP.MSG = Msg[210]..GetLenLimit(LgMin) -- L2 risulterebbe minore di ..0
end
end
if L5 < LgMin then
L5 = LgMin L1 = L5 + Ky + LZ
if CMP.ERR == 0 then
CMP.ERR = 6
CMP.MSG = Msg[211]..GetLenLimit(LgMin) -- L5 risulterebbe troppo piccola
end
end
-- Se Preview cancello tutto
if bPreview then
EgtNewFile()
EgtSetDefaultMaterial( BLACK())
end
-- Pezzo e Layer
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- pezzo
local Ly = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
EgtSetName(Ly,'OutLoop')
local Lr = EgtGroup(Pz,GDB_RT.LOC) -- layer regione
EgtSetName(Lr,'Region')
local Lc = EgtGroup(Pz,GDB_RT.LOC) -- layer di costruzione
local La = EgtGroup(Pz,GDB_RT.LOC) -- layer ausiliario (diagonali e relative etichette, assi)
EgtSetName(La,"LayAux")
local Le = EgtGroup(Pz,GDB_RT.LOC) -- layer delle etichette pezzo
EgtSetName(Le,"Etichette")
local Lq = EgtGroup(Pz,GDB_RT.LOC) -- layer delle linee di quotatura
EgtSetName(Lq,"Quotature")
EgtSetCurrPartLayer(Pz,Ly)
-- Costruzione della figura
local l1 = EgtLinePDL(Ly,ORIG()+Vector3d(0,L1,0),-90,L1)
EgtSetName(l1,"A1")
local l2 = EgtLinePDL(Ly,EgtEP(l1),0,L2)
local pC = EgtEP(l2) + Vector3d(0,1,0)*LR -- centro dell'arco di raccordo
local l3 = EgtArc(Ly,pC,LR,-90,45,0) -- arco di raccordo
local l4 = EgtLinePDL(Ly,EgtEP(l3),45,L4)
local l5 = EgtLinePDL(Ly,EgtEP(l4),90,L5)
EgtSetName(l5,"A3")
local l6 = EgtLine(Ly,EgtEP(l5),EgtSP(l1))
EgtSetName(l6,"A2")
-- diagonali e assi di simmetria
local d1, D1, a1
if CMP.ERR == 0 then
d1 = EgtLine(La,EgtEP(l1),EgtSP(l6))
D1 = EgtCurveLength(d1)
a1 = EgtLinePDL(La,EgtMP(l6),-90,L1)
end
if Lc then
EgtErase(Lc)
end
-- Riempimento della figura
local e1 = EgtCurveCompo(Ly,{l1,l2,l3,l4,l5,l6},false)
local s1 = EgtSurfFlatRegion(Lr,e1)
if CMP.ERR == 0 then
EgtSetColor(s1,AQUA())
else
EgtSetColor(s1,ORANGE())
end
EgtSetAlpha(s1,25)
EgtErase(e1)
local dim = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD):getRadius() * 0.1
-- linee di quotatura
local pt local vr -- punto e vettore per costruzioni
pt = EgtEP(l2,Lq) + Vector3d(Kx,-dim,0)
local DimLineLZ = EgtLinePDL(Lq,pt,0,LZ)
EgtLinePDL(Lq,EgtSP(DimLineLZ)-Vector3d(0,dim*.25,0),90,dim/2) -- trattino di estensione
EgtLinePDL(Lq,EgtEP(DimLineLZ)-Vector3d(0,dim*.25,0),90,dim/2) -- trattino di estensione
pt = EgtMP(DimLineLZ,Lq)+Vector3d(0,-dim*.25,0)
local lnZ1 = EgtLinePDL(Lq,pt,-60,dim/2) -- trattino per direttrice
local lnZ2 = EgtLinePDL(Lq,EgtEP(lnZ1),-90,dim/2) -- " " "
-- raggio
pt = EgtMP(l3) vr = EgtMV(l3,Lq) --vr = VRotaded(EgtMV(l3,Lq),90) non può funzionare?
local DimLineR1 =EgtLine(Lq,pt+VRotated(-vr,-90)*2*dim,pt)
--local DimLineR2 =EgtLine(Lq,pt,pt+VRotated(-vr,90)*dim/2)
vr = EgtSV(DimLineR1,Lq) pt = EgtSP(DimLineR1)+vr*dim/2
local DimLineR3 = EgtLine(Lq,pt-VRotated(vr,90)*dim,pt)
pt = EgtEP(DimLineR1) vr = EgtEV(DimLineR1)
EgtLinePVL(Lq,pt,VRotated(-vr,-15),dim*.4) -- freccia di quotatura
EgtLinePVL(Lq,pt,VRotated(-vr, 15),dim*.4)
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,d1})
EgtInvertCurve({DimLineLZ,lnZ2,DimLineR3})
EgtSetInfo(La,"SIMM","1")
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6})
EgtInvertCurve({DimLineLZ,lnZ2})
EgtSetInfo(La,"RIB","1")
end
EgtReorderCurvesInGroup(Ly,ORIG())
-- Dimensioni dell'oggetto
local bbox = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD)
local dimX = EgtToUiUnits(bbox:getDimX())
local dimY = EgtToUiUnits(bbox:getDimY())
dim = bbox:getRadius() * 0.1
if CMP.ERR == 0 then
CMP.MSG = Msg[1] .. EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
end
local pVal
if Rib then
pVal= bbox:getMin() - Vector3d(0,dim*3,0)
else
pVal= bbox:getMin() - Vector3d(0,dim*4,0)
end
-- Dimensioni sull'oggetto
local ptP = 0.5 * ( bbox:getMin() + bbox:getMax())
local sDim = EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
local dDim = bbox:getRadius() * 0.1
local dRot = 0
if dimY > dimX then
dRot = 90
end
local LbOn = AddLabelPnt(Lr,ptP,sDim,dDim,dRot,BLACK())
EgtSetStatus(LbOn,GDB_ST.OFF)
-- Etichette sulla figura
local stdoffset = 1
local LblL1 = AddLabel(Le,l1,stdoffset,CMP.N1,dim,-90,RED()) EgtSetInfo(LblL1,"Var",1)
local LblL6 = AddLabel(Le,l6,stdoffset*.75,CMP.N2,dim,-90,RED()) EgtSetInfo(LblL6,"Var",2)
local LblLR = AddLabelAl(Le,DimLineR3,stdoffset*.0,CMP.N4,dim*.8,90,RED()) EgtSetInfo(LblLR,"Var",3)
EgtErase(DimLineR3)
local LblLZ = AddLabel(Le,lnZ2,stdoffset*.5,CMP.N3,dim,90,RED()) EgtSetInfo(LblLZ,"Var",4)
EgtErase(lnZ2)
local LblL2 = AddLabel(Le,l2,stdoffset,L2label,dim*.75,-90,GREEN())
local LblL5 = AddLabel(Le,l5,stdoffset,L5label,dim*.75,-90,GREEN())
if CMP.ERR == 0 then
LblD1 = AddLabelAl(La,d1,stdoffset*.75,D1label,dim/2,90,GREEN())
end
-- Etichette sotto la figura
local lLenL2 = EgtToUiUnits(L2)
local sLenL2 = EgtNumToString(lLenL2,1)
local ValL2 = EgtTextAdv(Le,pVal,0,L2label..'='..sLenL2,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL2,GREEN())
EgtSetStatus(ValL2,GDB_ST.SEL)
local ValL2Len = (EgtEP(ValL2,GDB_RT.GLOB)-EgtSP(ValL2,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL2Len,0,0)
local lLenL5 = EgtToUiUnits(L5)
local sLenL5 = EgtNumToString(lLenL5,1)
local ValL5 = EgtTextAdv(Le,pVal,0,L5label..'='..sLenL5,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL5,GREEN())
EgtSetStatus(ValL5,GDB_ST.SEL)
local ValL5Len = (EgtEP(ValL5,GDB_RT.GLOB)-EgtSP(ValL5,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL5Len,0,0)
if CMP.ERR == 0 then
local lLenD1 = EgtToUiUnits(D1)
local sLenD1 = EgtNumToString(lLenD1,1)
local ValD1 = EgtTextAdv(La,pVal,0,D1label..'='..sLenD1,'',100,'S',dim*.5,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValD1,GREEN())
EgtSetStatus(ValD1,GDB_ST.SEL)
end
-- Se non Preview
if not bPreview then
-- cancello etichette e parti ausiliarie (es.: altezze, diagonali )
EgtErase({La,Le,Lq})
-- rendo visibile label sul pezzo
EgtSetStatus(LbOn,GDB_ST.ON)
end
-- Se ok
if CMP.ERR == 0 then
-- scrivo i parametri nelle info del pezzo
WriteCompoDataToPart(Pz,CMP.Nome,CMP.Npar)
-- salvo i parametri come nuovo default
SaveCompoData(CMP.Npar)
end
end
_G.CMP_Draw = CMP_Draw
+7
View File
@@ -0,0 +1,7 @@
CMP.V1=1800
CMP.V2=2000
CMP.V3=600
CMP.V4=500
CMP.V5=110
CMP.V6=false
CMP.V7=false
+316
View File
@@ -0,0 +1,316 @@
-- 2015/10/__
-- PIANO CUCINA CON LAVORAZIONE A L CON ANGOLO ANCHE NON RETTO
-- Intestazioni
require('EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
EgtAddToPackagePath(EgtGetSourceDir() .. 'LuaLibs\\?.lua')
require( 'EgtCompo')
local Nome = 'PCucinaC1'
-- Valori limite
local LgMin = 10 -- lati
local AlfaMin = 60
local AlfaMax = 150
-- Parametri : dichiarazione e valori standard
--.T (tipo) : 0=null, 1=bool, 2=int, 3=len, 4=num, 5=string
local CMP = {}
CMP.N1 = 'A' -- lato lungo muro 'obliquo'
CMP.T1 = 3
CMP.V1 = 1800
CMP.N2 = 'B' -- lato lungo muro 'orizzontale'
CMP.T2 = 3
CMP.V2 = 2000
CMP.N3 = 'C' -- profondità lato 'obliquo'
CMP.T3 = 3
CMP.V3 = 600
CMP.N4 = 'D' -- profondità lato 'orizzontale'
CMP.T4 = 3
CMP.V4 = 500
CMP.N5 = 'a' -- angolo Alfa tra i muri (compreso tra AlfaMin e AlfaMax)
CMP.T5 = 4
CMP.V5 = 110
CMP.N6 = '←→' -- Simmetria dx/sx (true = svuotamento a dx)
CMP.T6 = 1
CMP.V6 = false
CMP.N7 = '↑↓' -- Simmetria su/giù ('ribaltamento') (true = 'L' capovolta)
CMP.T7 = 1
CMP.V7 = false
CMP.Npar = 7
CMP.Nome = Nome
CMP.WithInt = true
_G.CMP = CMP
-- Aggiorno con ultimi valori salvati (se presenti)
CMP.DATA = EgtGetSourceDir() .. CMP.Nome ..'.dat'
LoadCompoData()
function CMP_Draw(bPreview)
-- Carico i messaggi
local Msg = require('EgtCompoMsg')
-- Assegnazioni
local L1 = CMP.V1
local L2 = CMP.V2
local L3 = CMP.V3
local L4 = CMP.V4
local Alfa = CMP.V5
local Simm = CMP.V6
local Rib = CMP.V7
local L5label = 'E' -- lato 'obliquo' interno
local L6label = 'F' -- lato 'orizzontale' interno
local D1label = 'd' -- diagonale
CMP.ERR = 0
CMP.MSG = ''
--Verifica di compatibilità dei dati di input
if L1 < LgMin then
L1 = LgMin
CMP.ERR = 1
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a ...
end
if L2 < LgMin then
L2 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 2
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
if L3 < LgMin then
L3 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 3
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
if L4 < LgMin then
L4 = LgMin
if CMP.ERR == 0 then
CMP.ERR = 4
CMP.MSG = Msg[2]..GetLenLimit(LgMin) --Le dimensioni dei lati devono essere > = a...
end
end
if Alfa < AlfaMin then
Alfa = AlfaMin
if CMP.ERR == 0 then
CMP.ERR = 5
CMP.MSG = Msg[220]..AlfaMin..' e '..AlfaMax -- L'angolo Alfa deve essere compreso tra ... e ...
end
end
if Alfa > AlfaMax then
Alfa = AlfaMax
if CMP.ERR == 0 then
CMP.ERR = 6
CMP.MSG = Msg[220]..AlfaMin..' e '..AlfaMax -- L'angolo Alfa deve essere compreso tra ... e ...
end
end
-- Se Preview cancello tutto
if bPreview then
EgtNewFile()
EgtSetDefaultMaterial( BLACK())
end
-- Pezzo e Layer
local Pz = EgtGroup(GDB_ID.ROOT,GDB_RT.LOC) -- pezzo
local Ly = EgtGroup(Pz,GDB_RT.LOC) -- layer della figura principale
EgtSetName(Ly,'OutLoop')
local Lr = EgtGroup(Pz,GDB_RT.LOC) -- layer regione
EgtSetName(Lr,'Region')
local Lc = EgtGroup(Pz,GDB_RT.LOC) -- layer di costruzione
local La = EgtGroup(Pz,GDB_RT.LOC) -- layer ausiliario (diagonali e relative etichette, assi)
EgtSetName(La,"LayAux")
local Le = EgtGroup(Pz,GDB_RT.LOC) -- layer delle etichette pezzo
EgtSetName(Le,"Etichette")
local Lq = EgtGroup(Pz,GDB_RT.LOC) -- layer delle linee di quotatura
EgtSetName(Lq,"Quotature")
EgtSetCurrPartLayer(Pz,Ly)
-- Costruzione della figura
local vAlfa = Vector3d (cos(Alfa),sin(Alfa),0)
local l1 = EgtLinePVL(Ly,ORIG(),vAlfa,L1) EgtInvertCurve(l1)
EgtSetName(l1,"A6")
local l2 = EgtLinePDL(Ly,ORIG(),0,L2)
EgtSetName(l2,"A1")
local l3 = EgtLinePVL(Ly,EgtSP(l1),VRotated(vAlfa,-90),L3) EgtInvertCurve(l3)
EgtSetName(l3,"A5")
local l4 = EgtLinePDL(Ly,EgtEP(l2),90,L4)
EgtSetName(l4,"A2")
local arcAlfa , rrefAlfa
rrefAlfa = min(L1,L2)/5
arcAlfa = EgtArcC2P(La,EgtSP(l2),EgtSP(l2)+EgtEV(l2)*rrefAlfa,EgtSP(l1))
-- chiusura dei lati l5 e l6 se possibile
local l5 = EgtLinePVL(Ly,EgtSP(l3),VRotated(vAlfa,180),L1)
EgtInvertCurve(l5)
EgtSetName(l5,"A4")
local l6 = EgtLinePDL(Ly,EgtEP(l4),180,L2)
EgtSetName(l6,"A3")
if EgtIP(l5,l6,EgtSP(l3)) then
EgtModifyCurveStartPoint(l5,EgtIP(l5,l6,EgtSP(l3)))
EgtModifyCurveEndPoint(l6,EgtIP(l5,l6,EgtSP(l3)))
L5 = EgtCurveLength(l5)
L6 = EgtCurveLength(l6)
if L5 < LgMin then
if CMP.ERR == 0 then
CMP.ERR = 8
CMP.MSG = Msg[223]..GetLenLimit(LgMin) -- un lato risulta troppo piccolo (minore di ..)
end
end
if L6 < LgMin then
if CMP.ERR == 0 then
CMP.ERR = 9
CMP.MSG = Msg[223]..GetLenLimit(LgMin) -- un lato risulta troppo piccolo (minore di ..)
end
end
else
-- if CMP.ERR == 0 then
CMP.ERR = 7
CMP.MSG = Msg[221] -- figura impossibile
--end
end
-- diagonali e assi di simmetria
local d1, D1, a1, a2
if CMP.ERR == 0 then
d1 = EgtLine(La,EgtSP(l1),EgtEP(l2))
D1 = EgtCurveLength(d1)
a1 = EgtLinePVL(La,EgtMP(l3),VRotated(vAlfa,180),L1)
a2 = EgtLinePDL(La,EgtMP(l4),180,L2)
EgtModifyCurveEndPoint(a1,EgtIP(a1,a2,EgtEP(l6)))
EgtModifyCurveEndPoint(a2,EgtIP(a1,a2,EgtEP(l6)))
end
if Lc then
EgtErase(Lc)
end
-- Riempimento della figura
local e1, s1
if CMP.ERR ~= 7 then
e1 = EgtCurveCompo(Ly,{l1,l2,l4,l6,l5,l3},false)
s1 = EgtSurfFlatRegion(Lr,e1)
if CMP.ERR == 0 then
EgtSetColor(s1,AQUA())
else
EgtSetColor(s1,ORANGE())
end
EgtSetAlpha(s1,25)
EgtErase(e1)
end
-- Simmetria orizzontale
if Simm then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),X_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,arcAlfa})
if CMP.ERR == 0 then
EgtInvertCurve(d1)
end
EgtSetInfo(La,"SIMM","1")
end
-- Simmetria verticale ('ribaltamento')
if Rib then
EgtMirror({Ly,Lr,La,Le,Lq},ORIG(),Y_AX(),GDB_RT.GLOB)
EgtInvertCurve({l1,l2,l3,l4,l5,l6,arcAlfa})
EgtSetInfo(La,"RIB","1")
end
EgtReorderCurvesInGroup(Ly,ORIG())
-- Dimensioni dell'oggetto
local bbox = EgtGetBBoxGlob(Ly,GDB_BB.STANDARD)
local dimX = EgtToUiUnits(bbox:getDimX())
local dimY = EgtToUiUnits(bbox:getDimY())
local dim = bbox:getRadius() * 0.1
if CMP.ERR == 0 then
CMP.MSG = Msg[1] .. EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
end
local pVal
if Rib then
pVal= bbox:getMin() - Vector3d(0,dim*3,0) -- uguali, se non ci sono linee di quotatura sotto la fiura
else
pVal= bbox:getMin() - Vector3d(0,dim*3,0)
end
-- Dimensioni sull'oggetto
local LbOn
if CMP.ERR == 0 then
local sDim = EgtNumToString(dimX,2) .. ' x ' .. EgtNumToString(dimY,2)
local dDim = bbox:getRadius() * 0.1
if L1 > L2 then
LbOn = AddLabelPnt(Lr,EgtMP(a1,GDB_ID.ROOT),sDim,dDim,90,BLACK())
else
LbOn = AddLabelPnt(Lr,EgtMP(a2,GDB_ID.ROOT),sDim,dDim,0,BLACK())
end
EgtSetStatus(LbOn,GDB_ST.OFF)
end
-- Etichette sulla figura
local stdoffset = 1
local LblL1 = AddLabel(Le,l1,stdoffset,CMP.N1,dim,-90,RED())
EgtSetInfo(LblL1,"Var",1)
local LblL2 = AddLabel(Le,l2,stdoffset,CMP.N2,dim,-90,RED())
EgtSetInfo(LblL2,"Var",2)
local LblL3 = AddLabel(Le,l3,stdoffset,CMP.N3,dim,-90,RED())
EgtSetInfo(LblL3,"Var",3)
local LblL4 = AddLabel(Le,l4,stdoffset,CMP.N4,dim,-90,RED())
EgtSetInfo(LblL4,"Var",4)
local LblAlfa = AddLabel(Le,arcAlfa,stdoffset*.5,CMP.N5,dim*.8,-90,RED())
EgtSetInfo(LblAlfa,"Var",5)
if CMP.ERR == 0 then
local LblL5 = AddLabel(Le,l5,stdoffset,L5label,dim*.75,-90,GREEN())
local LblL6 = AddLabel(Le,l6,stdoffset,L6label,dim*.75,-90,GREEN())
local LblD1 = AddLabelAl(Le,d1,stdoffset*.75,D1label,dim/2,90,GREEN())
end
-- Etichette sotto la figura
if CMP.ERR == 0 then
local lLenL5 = EgtToUiUnits(L5)
local sLenL5 = EgtNumToString(lLenL5,1)
local ValL5 = EgtTextAdv(Le,pVal,0,L5label..'='..sLenL5,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL5,GREEN())
EgtSetStatus(ValL5,GDB_ST.SEL)
local ValL5Len = (EgtEP(ValL5,GDB_RT.GLOB)-EgtSP(ValL5,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL5Len,0,0)
local lLenL6 = EgtToUiUnits(L6)
local sLenL6 = EgtNumToString(lLenL6,1)
local ValL6 = EgtTextAdv(Le,pVal,0,L6label..'='..sLenL6,'',100,'S',dim*.75,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValL6,GREEN())
EgtSetStatus(ValL6,GDB_ST.SEL)
local ValL6Len = (EgtEP(ValL6,GDB_RT.GLOB)-EgtSP(ValL6,GDB_RT.GLOB)):getX() + dim/2
pVal = pVal + Vector3d(ValL6Len,0,0)
end
if CMP.ERR == 0 then
local lLenD1 = EgtToUiUnits(D1)
local sLenD1 = EgtNumToString(lLenD1,1)
local ValD1 = EgtTextAdv(Le,pVal,0,D1label..'='..sLenD1,'',100,'S',dim*.5,1,0,GDB_TI.BL,GDB_RT.GLOB)
EgtSetColor(ValD1,GREEN())
EgtSetStatus(ValD1,GDB_ST.SEL)
end
-- Se non Preview
if not bPreview then
-- cancello etichette e parti ausiliarie (es.: altezze, diagonali )
EgtErase({La,Le,Lq})
-- rendo visibile label sul pezzo
EgtSetStatus(LbOn,GDB_ST.ON)
end
-- Se ok
if CMP.ERR == 0 then
-- scrivo i parametri nelle info del pezzo
WriteCompoDataToPart(Pz,CMP.Nome,CMP.Npar)
-- salvo i parametri come nuovo default
SaveCompoData(CMP.Npar)
end
end
_G.CMP_Draw = CMP_Draw
CMP_Draw(true)
EgtZoom(SCE_ZM.ALL)
+2 -1
View File
@@ -1,4 +1,5 @@
-- 2015/10/__
-- 2015/10/__
-- PIANO CUCINA CON LAVORAZIONE A L CON ANGOLO ANCHE NON RETTO , SMUSSO o RACCORDO
-- Intestazioni
+8
View File
@@ -0,0 +1,8 @@
CMP.V1=1800
CMP.V2=2000
CMP.V3=600
CMP.V4=500
CMP.V5=86
CMP.V6=2
CMP.V7=false
CMP.V8=false
+2
View File
@@ -324,3 +324,5 @@ function CMP_Draw(bPreview)
end
end
_G.CMP_Draw = CMP_Draw
CMP_Draw(true)
EgtZoom(SCE_ZM.ALL)
Binary file not shown.
Binary file not shown.
+7 -1
View File
@@ -37,12 +37,18 @@ local Ang = atan2((v1^v2)*Z_AX(),v1*v2)
-- ***************************************************************************
EgtText(GDB_ID.CL,{0,0,0}, Ang ,50,GDB_RT.GRID)
]]
--[[
l1 = EgtLinePDL( 2, {0,100,0}, 0, 1000)
l2 = EgtLinePDL( 2, {0.,500,0}, -45, 1000)
Pt = EgtIP( l1, l2, {0,500,0})
if Pt then
EgtLine( 2, Pt, {0,0,0})
end
end ]]
Point = Point3d( 100, 100, 0)
--EgtLine( GDB_ID.ROOT, Point3d( 100, 100, 0), Point3d( 300, 300, 0) )
--EgtFrame( GDB_ID.ROOT, Frame3d( Point3d(100,100,0), Vector3d(1,-1,0), Vector3d(1,1,0),Vector3d(0,0,1)),GDB_RT.GLOB)
EgtFrame( GDB_ID.ROOT, Frame3d( Point, Vector3d(1,-1,0), Vector3d(1,1,0),Vector3d(0,0,1)),GDB_RT.GLOB)
--G.CMP_Draw = CMP_Draw
EgtZoom(SCE_ZM.ALL)
Binary file not shown.