Command Line Interface Reference Guide

– MESHMAGICK –

A python module and a command line utility to manipulate meshes from different format used in hydrodynamics as well as for visualization.

The formats currently supported by meshmagick are :

File extension

R: Reading W: writing

Software

Keywords

.mar

R/W

NEMOH 1

nemoh, mar

.nem

R

NEMOH 1

nemoh_mesh, nem

.gdf

R/W

WAMIT 2

wamit, gdf

.inp

R

DIODORE 3

diodore-inp, inp

.DAT

W

DIODORE 3

diodore-dat

.hst

R/W

HYDROSTAR 4

hydrostar, hst

.nat

R/W

natural, nat

.msh

R

GMSH 5

gmsh, msh

.rad

R

RADIOSS

rad, radioss

.stl

R/W

stl

.vtu

R/W

PARAVIEW 6

vtu

.vtp

R/W

PARAVIEW 6

vtp

.vtk

R/W

PARAVIEW 6

paraview-legacy, vtk

.tec

R/W

TECPLOT 7

tecplot, tec

.med

R

SALOME 8

med, salome

.obj

R

WAVEFRONT

obj

By default, Meshmagick uses the filename extensions to choose the appropriate reader/writer. This behaviour might be bypassed using the -ifmt and -ofmt optional arguments. When using these options, keywords defined in the table above must be used as format identifiers.

Footnotes

1(1,2)

NEMOH is an open source BEM Software for seakeeping developped at Ecole Centrale de Nantes (LHHEA)

2

WAMIT is a BEM Software for seakeeping developped by WAMIT, Inc.

3(1,2)

DIODORE is a BEM Software for seakeeping developped by PRINCIPIA

4

HYDROSTAR is a BEM Software for seakeeping developped by BUREAU VERITAS

5

GMSH is an open source meshing software developped by C. Geuzaine and J.-_faces. Remacle

6(1,2,3)

PARAVIEW is an open source visualization software developped by Kitware

7

TECPLOT is a visualization software developped by Tecplot

8

SALOME-MECA is an open source software for computational mechanics developped by EDF-R&D

usage: meshmagick [-h] [-o OUTFILENAME] [-ifmt INPUT_FORMAT] [-ofmt OUTPUT_FORMAT] [-q] [-i] [--quality] [-t Tx Ty Tz] [-tx Tx] [-ty Ty] [-tz Tz] [-r Rx Ry Rz] [-rx Rx] [-ry Ry] [-rz Rz] [-s S] [-sx Sx] [-sy Sy] [-sz Sz] [-hn] [-fn]
                  [-hm] [-p Arg [Arg ...]] [-c [Arg [Arg ...]]] [-cc CONCATENATE_FILE] [-md [Tol]] [-tq] [-sym [Arg [Arg ...]]] [--mirror Arg [Arg ...]] [-pi] [-si] [--rho-medium RHO_MEDIUM] [--list-medium] [--thickness THICKNESS]
                  [-pn Project Name] [-hs] [-mdisp Disp] [-cog Xg Yg Zg] [-zg Zcog] [-lpp Lpp] [-ap] [-wd Rho] [-g G] [--hs-report filename] [-sh] [-v]
                  infilename

Positional Arguments

infilename

path of the input mesh file in any supported format

Named Arguments

-o, --outfilename
path of the output mesh file. The format of

this file is determined from the given extension.

-ifmt, --input-format
Input format. Meshmagick will read the input file considering the

INPUT_FORMAT rather than using the extension

-ofmt, --output-format
Output format. Meshmagick will write the output file considering

the OUTPUT_FORMAT rather than using the extension

-q, --quiet

switch of verbosity of meshmagick

Default: False

-i, --info

extract informations on the mesh on the standard output

Default: False

--quality

prints mesh quality

Default: False

-t, --translate
translates the mesh in 3D

Usage -translate tx ty tz

-tx, --translatex

translates the mesh following the x direction

-ty, --translatey

translates the mesh following the y direction

-tz, --translatez

translates the mesh following the z direction

-r, --rotate
rotates the mesh in 3D following a rotation

coordinate vector. It is done around fixed axis. Angles must be given in degrees.

-rx, --rotatex
rotates the mesh around the x direction.

Angles must be given in degrees.

-ry, --rotatey
rotates the mesh around the y direction.

Angles must be given in degrees.

-rz, --rotatez
rotates the mesh around the z direction.

Angles must be given in degrees.

-s, --scale
scales the mesh. CAUTIONif used along

with a translation option, the scaling is done after

the translations. The translation magnitude should be set accordingly to the original mesh.

-sx, --scalex
scales the mesh along x axis. CAUTIONif used along

with a translation option, the scaling is done after

the translations. The translation magnitude should be set accordingly to the original mesh.

-sy, --scaley
scales the mesh along y axis. CAUTIONif used along

with a translation option, the scaling is done after

the translations. The translation magnitude should be set accordingly to the original mesh.

-sz, --scalez
scales the mesh along z axis. CAUTIONif used along

with a translation option, the scaling is done after

the translations. The translation magnitude should be set accordingly to the original mesh.

-hn, --heal-normals
Checks and heals the normals consistency and

verify if they are outward.

Default: False

-fn, --flip-normals

flips the normals of the mesh

Default: False

-hm, --heal-mesh
Applies the following sanity transformation on the

mesh: Removes unused vertices, Removes degenerated faces, Merge duplicate vertices, Heal triangles description, Heal normal orientations.

Default: False

-p, --plane
Defines a plane used by the –clip_by_plane and –symmetrize options.

It can be defined by the floats nx ny nz c where [nx, ny, nz] is a normal vector to the plane and c defines its position following the equation <N|X> = c with X a point belonging to the plane. It can also be defined by a string among [Oxy, Oxz, Oyz, /Oxy, /Oxz, /Oyz] for quick definition. Several planes may be defined on the same command line. Planes with a prepended ‘/’ have normals inverted i.e. if Oxy has its normal pointing upwards, /Oxy has its normal pointing downwards. In that case, the planes are indexed by an integer starting by 0 following the order given in the command line.

-c, --clip-by-plane
cuts the mesh with a plane. Is no arguments are given, the Oxy plane

is used. If an integer is given, it should correspond to a plane defined with the –plane option. If a key string is given, it should be a valid key (see help of –plane option for valid plane keys). A normal and a scalar could also be given for the plane definition just as for the –plane option. Several clipping planes may be defined on the same command line.

-cc, --concatenate-file
Concatenate a mesh from the specified path. The file format has to be

the same as the input file.

-md, --merge-duplicates
merges the duplicate nodes in the mesh with the absolute tolerance

given as argument (default 1e-8). Tolerance must be lower than 1

-tq, --triangulate-quadrangles
Triangulate all quadrangle _faces by a simple splitting procedure.

Twho triangles are generated and from both solution, the one with the best aspect ratios is kept. This option may be used in conjunction with a mesh export in a format that only deal with triangular cells like STL format.

Default: False

-sym, --symmetrize
Symmetrize the mesh by a plane defined wether by 4 scalars, i.e.

the plane normal vector coordinates and a scalar c such as N.X=c is the plane equation (with X a point of the plane) or a string among [‘Oxy’, ‘Oxz’, ‘Oyz’, ‘/Oxy’, ‘/Oxz’, ‘/Oyz’] which are shortcuts for planes passing by the origin and whose normals are the reference axes. Default is Oxz if no argument is given to –sym option. Be careful that symmetry is applied before any rotation so as the plane equation is defined in the initial frame of reference.

--mirror
Mirror the mesh through the specified plane. Plane may be specified

with reference planes keys (see –plane option), or by 4 scalars, or by the id of a plane defined with the –plane option. By default, the Oxy plane is used when the option has no argument.

-pi, --plain-inertia
Evaluates the inertia properties of the mesh condidering it as

uniformly plain of a medium of density rho_medium in kg/m**3. Default is 1023 kg/m**3.

Default: False

-si, --shell-inertia
Evaluates the inertia properties of the mesh condidering it as

uniformly plain of a medium of density rho_medium in kg/m**3. Default is 1023 kg/m**3.

Default: False

--rho-medium
The density (in kg/m**3) of the medium used for evaluation of

inertia parameters of the mesh. For the hypothesis of plain homogeneous mesh, the default is that of salt water (1023 kg/m**3) . For the hypothesis of a shell, default is that of steel (7850 kg/m**3).

It is possible to specify medium by a name. Available medium are currently: CONCRETE, REINFORCED_CONCRETE, FRESH_WATER, SALT_WATER, SAND, STEEL, ALUMINUM, LEAD, TITANIUM, POLYSTYRENE, GASOLINE, DIESEL_FUEL, ETHANOL, AIR_20DEGC, BUTANE, PROPANE, HYDROGEN_-252DEGC, NITROGEN_-195DEGC

--list-medium

Lists the available medium keywords along with their density.

Default: False

--thickness
The thickness of the shell used for the evaluation of inertia

parameters of the mesh. The default value is 0.02m.

-pn, --project-name

The project name for hydrostatics ourput

Default: “NO_NAME”

-hs, --hydrostatics
Compute hydrostatics data and throws a report on the

command line. When used along with options -mdisp, –cog or –zcog, the behaviour is different.

Default: False

-mdisp, --mass-displacement
Specifies the mass of the mesh for hydrostatic computations.

It MUST be given in tons.

-cog, --cog
Specifies the 3D position of the center of gravity.

The third coordinate given has priority over the value given with the –zcog option.

-zg, --zcog
Specifies the z position of the center of gravity. This

is the minimal data needed for hydrostatic stiffness matrix computation. It is however overwriten by the third component of cog when –cog option is used. If none of these two option is given, zcog is set to 0.

-lpp, --lpp
Specifies the Lpp value as it cannot be calculated with

only the mesh as it depends on the AP position that is a rudder position dependent information that the mesh does not enclose. It helps do better inertia (Iyy & Izz) approximations using standard formulas. See also the alternative -AP formula.

-ap, --orig-at-ap
Tell the solver that the origin is ar After perpendicular

sot that lpp can be calculated from this information.

Default: False

-wd, --water-density

Specifies the density of salt water. Default is 1025 kg/m**3.

Default: 1025.0

-g, --grav
Specifies the acceleration of gravity on the earth surface.

Default is 9.81 m/s**2.

Default: 9.81

--hs-report

Write the hydrostatic report into the file given as an argument

-sh, --show

Shows the input mesh in an interactive window

Default: False

-v, --version

Shows the version number and exit

– Copyright 2014-2021 - Francois Rongere / Ecole Centrale de Nantes –