.. _d7.01.02-solution: Files fixed ================= Order catalog: .. code-block:: python from.commons import* from.. language.DataStructure import* from.. language.Syntax import* CONV_MAIL_MED = MACRO ( name=" CONV_MAIL_MED ", op= OPS ("code_aster.macrocommands.conv_mail_med_ops.conv_mail_med_ops"), sd_prod=table_sdaster, reentrant="n", fr=tr ("Convert a ASTER, GMSH, or GIBI mesh to the MED format. "), UNITE_IN = SIMP (status="o", typ="I"), FORMAT_IN = SIMP (status="f", typ=" TXM ", typ=" ", default=" ASTER ", into =(" ASTER "," GIBI "," GMSH "," ")), UNITE_OUT = SIMP (status="f", typ="i", default=80), INFO = SIMP (status="f", typ="I", into =( 1, 2), default=1), ) Body of the macro command ``code_aster/macrocommands/conv_mail_med_ops.py``: .. code-block:: python from.Cata.Syntax import _F from.. codeCommands import CREA_TABLE, IMPR_RESU, LIRE_MAILLAGE from.. Messages import UTMESS def conv_mail_med_ops (self, UNITE_IN,, FORMAT_IN,, UNITE_OUT, **args): "" "Convert a mesh from ASTER, GMSH, or GIBI format to MED format and Return some mesh properties. Arguments: **args (dict): User's keywords. Returns: Table: Object containing some characteristics of the mesh. """ args = _F (args) info = args.get (" INFO ", 1) INFO is mandatory so: # info = args [" INFO "] # or adding INFO in arguments also works # print the information message UTMESS ("I", "MESH_1 ", valk= FORMAT_IN, vali =( UNITE_IN, UNITE_OUT)) # read the input mesh mesh = LIRE_MAILLAGE (FORMAT = FORMAT_IN, UNITE = UNITE_IN, INFO =info) # write the mesh into a MED file IMPR_RESU (FORMAT =" MED ", UNITE = UNITE_OUT, RESU =_F (MAILLAGE =mesh)) # extract some mesh characteristics nbnodes = mesh.getNumberOfNodes () nbcells = mesh.getNumberOfCells () # fill the output table tab = CREA_TABLE ( LISTE =( _F (PARA =( "NB_NOEUDS ",),), LISTE_I =( nbnodes,)), _F (PARA =( "NB_MAILLES ",),), LISTE_I =( nbcells,)), ) ) Return Tab