_Variables Atributos-para Listados

Embed Size (px)

Citation preview

W@UM_STD_DIM: W@UM_STD_OPT_DIM : MW_COMPONENT_NAME: W@UM_STD_OPT_LAB: : nombre fichero Parametric Sheet TemplatesFor a smarter sheet template solution, a tabular note cell can be populated with the following data in NX5: (You must add "" around the variables) Number of the current sheet: W@$SH_SHEET_NUMBER Total number of sheets: W@$SH_NUMBER_OF_SHEETS Numerator of the sheet scale: W@$SH_SHEET_SCALE_NUMERATOR Denominator of the sheet scale: W@$SH_SHEET_SCALE_DENOMINATOR Size of the current sheet: W@$SH_SHEET_SIZE Units of the current sheet: W@$SH_SHEET_UNITS Projection angle of the current sheet: W@$SH_SHEET_PROJECTION_ANGLE Master Model drawing sheet part name: W@$SH_MASTER_PART_NAME Sheet part name: W@$SH_PART_NAME--------- 2-way interaction between Expressions and AttributesUsing a little bit of Knowledge Fusion functions, it's easily possible to interact expressions with attributes, and vice versa.Suppose you have 3 expressions called 'length', 'width' and 'height' and you'd like to automatically update the part attributes called ATTR_length, ATTR_height and ATTR_width accordingly.(Why in the earth would I want to do that, you might ask- these values could well be part list columns, or some dirty ERP trick might be the case. Actually I need neither, but it's good to know that this can be done !)In the Expressions window, you need to create a dummy number expression, say 'test'. This needs to be a number, not a string variable.Then you need to set the value of 'test' using the following syntax : test = ug_setPartAttrValue( "ATTR_length", stringValue(length) )stringValue is another KF function to convert a numeric value into a string, which ug_setPartAttrValue requires.You can also get the value of an existing attribute, and assign it to an expression. This time, the syntax is : test2 = MakeNumber( ug_askPartAttrValue( "ATTR_width" )) where test2 is the expression to be updated.In order not to have lots of these dummy test variables, you could create a combined dummy, like: test = ug_setPartAttrValue( "x", stringValue( p1) ) + ug_setPartAttrValue( "y", stringValue( p2) ) +ug_setPartAttrValue( "z", stringValue( p3) )-------When I change an expression in the top part. The attributes made with ug_setPartAttrValue are well updated, but the attributes in the child part made with ug_setPartAttrValue with an expression linked to the top part are not updated.I need to enter one by one in the child components and open and close the expressions menu in order to have the attributes updated correctly.Scenario:1st part - top (with geometry) name="top_part"2nd part - child under top (a screw) name "screw_part"on top expressions:------------------------Vol=111111111A=if (Vol=580000000)(145) else (105)B=if (A=85) (40) else if (A=145) (70) else (50)E=if (A=85) (12) else if (A=145) (22) else (16)G=if (A=85) (10) else if (A=145) (24) else (16)DIM=ug_setPartAttrValue( "DIMENSION", format("%.0fx",A) + format("%.0fx",B) + format("%.0f",E))on 2nd part expressions:----------------------------mt="top_part"::GLtok=10DIM=ug_setPartAttrValue( "DIMENSION", format("M%.0fx",mt) + format("%.0f",Ltok))Now if I change the Vol expression in the top from 111111111 to 888888888 (nine ones or nine eights), the DIMENSION attribute in the child part (screw_part) is not updated (neither with the option update for a external change). As I said, I need to make work the child then open and close the expressions menu.Do you know any way to make the update automatically?HEAD_DIA : diametro cabeza----------------Hay alguna manera de mantener el texto idntico de una hoja a otra. Por ejemplo, en nuestras impresiones que tenemos un nmero de Proyectos de Ingeniera, que lo ha dado, la descripcin de revisin, etc Quiero Hoja 1 a ser el maestro y el resto de las hojas que caen en la lnea de lo que si la hoja 1 cambia, tambin lo hace el texto en la hoja 2, 3 ...Es su manera de crear "cadena" o datos de texto en la lista de expresiones en el modelo (para que pueda enlazar a que en el dibujo) o un mtodo similar que lograr lo que estoy pidiendo?Ejemplo de esto ....1) Pls abierto "Editor de expresiones" y Enter en el nombre del campo como "valor" y frmula de valor = 92) crear otro nombre Expresin como "prueba"3) Introducir en el campo de la frmula como "ug_setPartAttrValue (" reclamo ", stringValue (Value))"4) crear otro nombre Expresin como "Value_2" y frmula de valor = 45) Introduzca en el nombre del campo como "Test_2"6) Introduzca en el campo Formula como "ug_setPartAttrValue (" SMBOLO ID ", stringValue (Value_2))7) Entender que NX Expresin Crea Parte atributo.8) ug_setPartAttrValue: . Crea un atributo parte con un ttulo dado y el valor en el archivo dado. . Utilice el nombre y el valor del atributo para establecerlo.9) Ir al men Archivo -> Propiedades y seleccione la ficha "Atributos".10) se puede observar que los atributos de la Parte se crean mediante la definicin de las reglas de diseo. . LLAMADA Y . ID SMBOLOHaga clic en Herramientas> Expresiones (debe ser en el modelado)En el men de seleccin de tipo caja (por encima del campo de nombre de la expresin) hacia abajo, seleccione "STRING"A continuacin, poner en el nombre del texto y el texto que desee en el campo de frmula.Luego, en el campo de texto de la nota o anotacin dimensin, el tipo donde xxx es el nombre de expresinpor ejemplo, hace una TXT expresin con un valor de la frmula de "prueba de JVC". En el cuadro de texto de la letra, escrib r y hora la nota dira : prueba de JVC Con la ayuda de la metodologa mencionada anteriormente, puede automatizar personalizado "Lista de piezas". (BOM)Expresiones aparece en Redaccin Apllications estableciendo una variable ambiental. UGII_DRAFT_EXPRESSIONS_OK = {1}Pls establecer un atributo y llamar a una expresin Ejemplo: La expresin "Valor" = 9Entrada Dada = "VALOR" Valor de produccin = 9-------------------TORNILLOS DE MOLDWIZARDHEAD_HEIGHT: altura cabezaHEX_DIA : diametro hexagonoSCREW_DIA: medida tornillo (M-)LENGTH: longitud tornillo (sin la cabeza)T ornillos MDE Prototipo post. Hp5: llave exagono tornilloD: diametro cabeza torn.K: altura cabeza tornilloL (Ltok) : long tornillod (mtp): metrica tornillomtp_attr = ug_setPartAttrValue("Metrica",stringValue(mtp))+ug_setPartAttrValue("Long",stringValue(Ltok))nota: M-xTornillos DCMT : metrica tornilloL: longitudnota: M-x (enlace desde atributos)* M-x ( enlace directodesde exprs.)*EN LAS EXPRESIONES DE UNA PIEZA SE CREAN mtp (MT), L( Lotk), PASO..... CON VALORES NUMERICOS.LUEgO OTRA EXPRESION mtp_attr (ejemplo) CON ESTA FORMULAug_setPartAttrValue( "Metrica", stringValue( mtp) ) + ug_setPartAttrValue( "Long", stringValue( L) ) +ug_setPartAttrValue( "Paso", stringValue( PASO) )ESO DARA ORIGEN EN LA TABLA DE ATRIBUTOS (PROPIEDADES) AUTOMATICAMENTE A UNOS ATRIBUTOSMetrica ,long, Paso CON LOS VALORES (NO NUMERICOS) QUE HAY en MT, L , PASO--------- > MEDIDAS= "M-"+stringValue(mtp)+"x"+stringValue(L) en formato cadenaDIM_attr = en formato numerico--------------------------------------------------------------------------------------------------------------------------------EXPRESION: EXPR1FORMULA:IF(METRICA=3)(2)ELSE IF(METRICA=4)(2.5)ELSE IF(METRICA=5)(3)ELSE IF(METRICA=6)(4)ELSE IF(METRICA=8)(5)ELSE IF(METRICA=10)(6)ELSE IF(METRICA=12)(8)ELSE IF(METRICA=14)(10)ELSE(0)----------------------------------------------------------------------------------------------------------------------------Para convertir valores numericos de listado expresiones a valores texto en listado atributosEXPRESION: DIM_ATTRFORMULA (NUM.) : ug_setPartAttrValue( "DIMENSIONES", "M-"+ stringValue(mtp) + "x" + stringValue(L) )EXPRESIONALT_EXP_CATALOGOFORMULA IF(METRICA=3)(2)ELSE IF(METRICA=4)(2.5)ELSE IF(METRICA=5)(3)ELSE IF(METRICA=6)(4)ELSE IF(METRICA=8)(5)ELSE IF(METRICA=10)(6)ELSE IF(METRICA=12)(8)ELSE IF(METRICA=14)(10)ELSE(0)================================================================================EXPRESIONALT_EXP_CATALOGOFORMULA (p17=ALTURA EXPULSOR)if (p17100 & p17125 & p17 160 & p17 200 & p17 250 & p17 315)(400) else 0EXPRESIONDIM_ATTRFORMULA ug_setPartAttrValue("DIMENSIONES","AH-"+stringValue(DIAMETRO_EXPULSOR) + "x" + stringValue(ALT_EXP_CATALOGO) )----------------------------------------------------------------ANALISIS MEDIR DISTANCIA (ASOCIATIVA) NOS DARA EXPR. P151, P153,P155ATRIBUTODIM_ATTRFORMULAug_setPartAttrValue( "DIMENSIONES", format("%.1f",p151) +"x" +format("%.1f",p153)+"x"+format("%.1f",p155)+" Acabado")000000000000000000000Example for this....1) Pls open "Expression Editor " and Enter in the Name Field as "Value" and Formula Value = 92) Create another Expression Name as "Test"3) Enter in Formula Field as "ug_setPartAttrValue( "CALLOUT", stringValue( Value ) )"4) Create another Expression Name as "Value_2" and Formula Value = 45) Enter in the Name Field as "Test_2"6) Enter in Formula Field as "ug_setPartAttrValue( "ID SYMBOL", stringValue( Value_2 ) )7)Understand that NX Expression Creates Part Attribute.8) ug_setPartAttrValue :. Creates a part attribute with a given title and value in the given file.. Use the name and the value of the attribute to set it.9) Go to File Menu --> Properties and Select "Attributes" Tab.10)You can Notice that Part Attributes are created by defining the Design Rules.. CALLOUT&. ID SYMBOLPls let me know incase you need some other information on this.If anyone else ever comes here with the same question:Click Tools > Expressions (must be in modeling)On the TYPE selection drop down box (above the expression name field), Select "STRING"Then put in the NAME of the text and the text you want in the formula field.Then in the text field of the note or dimension annotation, type where xxx is the expression namefor example I made an expression DWN_BY with a formula value of "JJJ".In the text box on the print, I typedNow my note says JJJEASY!---------------------------------------------------------------------------------With help of the above mentioned Methodology , you can Automate customized "Partslist".( BOM )Expressions appears in Drafting Apllications by setting an Environmental Variable. {UGII_DRAFT_EXPRESSIONS_OK=1 } pls set an attribute and CALL an Expression Example : Expression "Value" = 9Input Given = "VALUE"OUTPUT VALUE= 9We use NX6 + Moldwizard and we are installing a new ERP in our company.I have built up a system which works more or less like these:1) when parts are imported from moldwizard library, some attributes are defined for each of them using its excel system;2) these attributes are imported into part expressions using KF command ug_askPartAttrValue();e.g.: (string)EXP_CALL=ug_askPartAttrValue( "ATTR_CALL" ), where EXP_CALL is the expression name and ATTR_CALL the attribute name;3) using the part expressions created, an excel file is queried in order to get an unique ERP part code;e.g.: (string)ERP_CODE=ug_cell_vlookup( getenv("UGII_DATA_ERP")+ug_askPartAttrValue("EXCEL_NAME")+".xls", EXP_CALL, "a1:b9000", 1, 0 ) It all works fine, a part from the fact that IT DOES NOT UPDATE! Unless: 1) I recursively enter the expression editor for each subpart of the assembly;2) I use tool->update->update for external changes, once per each part I need to update, assuming it as work part first;Is there a journal command or a macro or something similar, to make UG do this cumbersome update job on its own? My assemblies are very big