MorphoGraphX
|
Export a mesh on various formats: PLY format, VTK format, "text" format, "cells" format, MeshEdit format, STL format or OBJ format. More...
#include <SystemProcessSave.hpp>
Public Member Functions | |
MeshExport (const MeshProcess &proc) | |
bool | operator() (const QStringList &parms) |
Implementation of the process with generic arguments. More... | |
bool | operator() (Mesh *mesh, const QString &filename, const QString &type, bool transform) |
Export a mesh. More... | |
QString | folder () const |
Folder in which to place the process. More... | |
QString | name () const |
Returns the name of the process. More... | |
QString | description () const |
Returns a description of the process for the GUI. | |
QStringList | parmNames () const |
List of named parameters. More... | |
QStringList | parmDescs () const |
List of parameters descriptions. More... | |
QIcon | icon () const |
Icon to use to represent the process in the GUI. More... | |
QStringList | parmDefaults () const |
List of default parms. | |
ParmChoiceMap | parmChoice () const |
Purely for GUI purposes, provides for some of the parms parameter a choice. More... | |
bool | initialize (QStringList &parms, QWidget *parent) |
This is an optional method that is called only when a process is launched from the GUI. More... | |
![]() | |
QObject (QObject *parent=0) | |
blockSignals (bool block) | |
childEvent (QChildEvent *event) | |
children () | |
connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type=Qt::AutoConnection) | |
connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type=Qt::AutoConnection) | |
connectNotify (const char *signal) | |
customEvent (QEvent *event) | |
deleteLater () | |
destroyed (QObject *obj=0) | |
disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) | |
disconnect (const char *signal=0, const QObject *receiver=0, const char *method=0) | |
disconnect (const QObject *receiver, const char *method=0) | |
disconnectNotify (const char *signal) | |
dumpObjectInfo () | |
dumpObjectTree () | |
dynamicPropertyNames () | |
event (QEvent *e) | |
eventFilter (QObject *watched, QEvent *event) | |
findChild (const QString &name=QString() | |
findChildren (const QString &name=QString() | |
findChildren (const QRegExp ®Exp) | |
inherits (const char *className) | |
installEventFilter (QObject *filterObj) | |
isWidgetType () | |
killTimer (int id) | |
metaObject () | |
moveToThread (QThread *targetThread) | |
parent () | |
property (const char *name) | |
receivers (const char *signal) | |
removeEventFilter (QObject *obj) | |
sender () | |
setParent (QObject *parent) | |
setProperty (const char *name, const QVariant &value) | |
signalsBlocked () | |
startTimer (int interval) | |
thread () | |
timerEvent (QTimerEvent *event) | |
tr (const char *sourceText, const char *disambiguation=0, int n=-1) | |
trUtf8 (const char *sourceText, const char *disambiguation=0, int n=-1) | |
staticMetaObject | |
![]() | |
MeshProcess (const MeshProcess ©) | |
Copy constructor. More... | |
virtual QString | type () const |
Returns a string identifying the process type. | |
const Stack * | stack (int i) |
const Stack * | currentStack () |
std::pair < const_stack_iterator, const_stack_iterator > | stacks () const |
![]() | |
Process () | |
Default constructor. | |
Process (const Process &p) | |
Copy constructor. More... | |
virtual | ~Process () |
Virtual destructor. | |
void | actingFile (const QString &filename, bool project_file=false) |
Method to be called anytime a file is acted on (i.e. More... | |
QString | actingFile () const |
Get the file currently defining the path of the system. | |
QString | pythonCall (const QStringList &parms) const |
Return the python call describing the current process. | |
int | stackCount () const |
Number of stacks available to the process. | |
Stack * | stack (int i) |
Returns the ith stack, or 0 if there is no such stack. | |
Stack * | currentStack () |
Returns the current stack (i.e. More... | |
int | currentStackId () const |
Return the id (i.e. More... | |
void | setCurrentStackId (int i) |
Change which stack is current. | |
std::pair< stack_iterator, stack_iterator > | stacks () |
Iterate over all the stacks. | |
std::pair < const_stack_iterator, const_stack_iterator > | stacks () const |
Iterate over all the stacks. | |
Stack * | addStack () |
Add a new stack to the process. | |
bool | deleteStack (int i) |
Delete the stack of given id. More... | |
int | meshCount () const |
Returns the number of mesh available to the process. | |
Mesh * | mesh (int i) |
Returns the ith mesh. | |
Mesh * | currentMesh () |
Returns the current mesh (i.e. More... | |
int | currentMeshId () const |
Returns the id (i.e. More... | |
void | setCurrentMeshId (int i) |
Change which mesh is current. | |
std::pair< mesh_iterator, mesh_iterator > | meshes () |
Iterate over all the meshs. | |
std::pair< const_mesh_iterator, const_mesh_iterator > | meshes () const |
Iterate over all the meshs. | |
Mesh * | addMesh (const Stack *stack) |
Add a mesh to the process for the given stack. | |
bool | deleteMesh (int i) |
Remove a mesh from the process. | |
int | selectedLabel () const |
Get the current selected label. | |
void | setSelectedLabel (int label) |
Change the current selected label. | |
float | globalBrightness () |
Return the current setting for the global brightness level. | |
float | globalContrast () |
Return the current setting for the global contrast level. | |
void | setGlobalBrightness (float value) |
Change the current setting for the global brightness level. More... | |
void | setGlobalContrast (float value) |
Change the current setting for the global contrast level. More... | |
bool | meshSelection () const |
Returns if the user has mesh selection active. | |
bool | lineBorderSelection () const |
Returns is the user has line border selection active. | |
void | updateState () |
Update the state of the application from the current data. More... | |
void | updateViewer () |
Force the viewer to refresh, without pausing the process. | |
bool | setErrorMessage (const QString &str) |
Set an error message that will be displayed if the process returns false. | |
QString | errorMessage () const |
Get the current error message. | |
void | setWarningMessage (const QString &str) |
Set a warning message that will be displayed if the process returns true. | |
QString | warningMessage () const |
Get the current warning message. | |
void | userCancel () const |
Throw an exception informing the system that the user canceled the current process. | |
const QString & | file () const |
Get the name of the file that was used to load the current process (i.e. More... | |
Clip * | clip1 () |
Return the object defining the first clipping region. | |
Clip * | clip2 () |
Return the object defining the second clipping region. | |
Clip * | clip3 () |
Return the object defining the third clipping region. | |
const Clip * | clip1 () const |
Return the object defining the first clipping region. | |
const Clip * | clip2 () const |
Return the object defining the second clipping region. | |
const Clip * | clip3 () const |
Return the object defining the third clipping region. | |
CuttingSurface * | cuttingSurface () |
Return the cutting surface. | |
const CuttingSurface * | cuttingSurface () const |
Return the cutting surface. | |
QStringList | booleanChoice () const |
Helper function that provides a list of choices for a boolean argument. | |
QStringList | storeChoice () const |
Helper function that provides a list of choices for choosing from the main or work stack. | |
virtual uint | numParms () const |
Returns the number of named string for this process. | |
Process * | makeProcess (const QString &processType, const QString &processName) |
Creates a process object by name. | |
bool | RunProcess (Process &proc, const QStringList &parms) throw () |
Launch a process with generic arguments. More... | |
bool | RunProcess (const QString &processType, const QString &processName, const QStringList &parms) throw () |
Launch a process by name. More... | |
CheckState | checkState () |
Call this function and convert the result to a boolean. More... | |
Protected Slots | |
void | selectMeshFile () |
void | selectMeshType (const QString &type) |
Protected Member Functions | |
QString | properFile (QString filename, const QString &type) const |
void | setMeshFile (const QString &filename) |
Point3f | savedPos (Point3f pos, bool transform, const Stack *stack) |
bool | saveText (Mesh *mesh, const QString &filename, bool transform) |
bool | saveCells (Mesh *mesh, const QString &filename, bool transform) |
bool | saveMeshEdit (Mesh *mesh, const QString &filename, bool transform) |
bool | saveMeshSTL (Mesh *mesh, const QString &filename, bool transform) |
bool | saveVTU (Mesh *mesh, const QString &filename, bool transform, bool binary=false) |
bool | saveOBJ (Mesh *mesh, const QString &filename, bool transform) |
bool | savePLY (Mesh *mesh, const QString &filename, bool transform, bool binary=false) |
![]() | |
bool | systemCommand (SystemCommand cmd, const QStringList &parms) |
Method that can be used to launch a system command. More... | |
bool | stackCheck (int checks, int which) |
Check stack properties. | |
bool | storeCheck (int checks, int which) |
Check store properties. | |
bool | meshCheck (int checks, int which) |
Check mesh properties. | |
QString | stackError (int checks, int which) |
Generate a standardised string describing how the stack should be to not generate an error. | |
QString | storeError (int checks, int which) |
Generate a standardised string describing how the store should be to not generate an error. | |
QString | meshError (int checks, int which) |
Generate a standardised string describing how the mesh should be to not generate an error. | |
Protected Attributes | |
QDialog * | dlg |
Ui_ExportMeshDialog * | ui |
Export a mesh on various formats: PLY format, VTK format, "text" format, "cells" format, MeshEdit format, STL format or OBJ format.
We will here describe the file formats, or at least how MorphoGraphX uses them.
The PLY format is fully described on the website of the Paul Bourke: http://paulbourke.net/dataformats/ply/
It is also available on Wikipedia: https://en.wikipedia.org/wiki/PLY_(file_format)
MorphoGraphX exports only the two kind of elements described as mandatory: vertex and face.
In the case of a cell mesh, each vertex contains only its position (x,y,z). Otherwise, vertices also have their label.
In any case, each face contains the list of 0-based index into the vertex elements that form the face, and the label marking which cell the face is a part of. Vertices are oriented counter-clockwise.
MorphoGraphX save VTU format, which are XML files for unstructure grids.
The file format is quite complex, and fully described in the VTK book and website.
MorphoGraphX stores the following properties in addition to the mandatory ones:
For each vertex: 'Signal' (float32), 'Normals' (3 floats32), 'Color' (float32) and 'Label' (int32)
For each "cell" (e.g. triangles or 2D cells): 'Label' (int32)
MorphoGraphX also adds a DataArray to store the heat per VTU "cell". The name is either "Cell Heat" or "Wall Heat".
At last, an extra DataArray is created, store the heat per label instead of per cell.
The text format is a trivial ASCII file format. The file contains:
n vertex 0 vertex 1 ... vertex n-1 neighbors 0 neighbors 1 ... neighbors n-1
Each vertex is described as:
id x y z label
Each neighborhood is described as:
id m id_1 id_2 ... id_m
Where id
is the id of the current vertex, m
the number of neighbors, and id_1
, id_2
are vertex ids as described before. The vertex must be ordered counter-clockwise.
This format is very similar to the "text" format. Only each vertex is described as:
id x z y label type
Where type
is j
for junctions and c
for cell centers.
This file format is the one used by the MeshEdit software. In MorphoGraphX, the file has the following format
MeshVersionFormatted 1 Dimension 3 Vertices vertex 1 vertex 2 ... vertex n Triangles triangle 1 triangle 2 ... triangle m End
Each vertex is described as:
x y z label
And each triangle is described as:
v0 v1 v2 label
Again, the vertices must be ordered counter-clockwise.
The STL file format is the one used in many CAD software, including Abaqus.
In MorphoGraphX, the mesh is stored as a single solid called "mgx". The file structure is:
solid mgx facet 1 facet 2 ... facet n endsolid mgx
Where each facet is described as:
facet normal nx ny nz outer loop vertex vx1 vy1 vz1 vertex vx2 vy2 vz2 vertex vx3 vy3 vz3 endloop endfacet
MorphoGraphX can also export files in the WaveFront's OBJ file format.
The file has the following structure:
# Triangular mesh created by MorphoGraphX # Length unit: µm # Vertices vertex 1 vertex 2 ... vertex n # Triangles triangle 1 triangle 2 ... triangle m
Each vertex is stored as:
v x y z vn nx ny nz
And each triangle as:
f v1 v2 v3
where v1
, v2
and v3
are 1-based index in the vertex array. Also, the vertices are oriented counter-clockwise.
|
inlinevirtual |
Folder in which to place the process.
Subfolders can be specified by placing '/' in the path
Reimplemented from mgx::process::Process.
|
inlinevirtual |
Icon to use to represent the process in the GUI.
Note that to use an icon present in the resources, you must precede the path with a colon (i.e. ":/images/myicon.png".
Reimplemented from mgx::process::Process.
|
virtual |
This is an optional method that is called only when a process is launched from the GUI.
If reimplemented, it receives a potential argument list, and should provide a GUI for editing it. Once the user finishing the edition, this method should modify the provided arguments and return true. If the user aborts, the method should return false. Note that returning false does not produce an error.
parms | List of arguments |
parent | Pointer to the parent widget. If the configure method creates a GUI, it should be a child of this widget. |
Reimplemented from mgx::process::Process.
|
inlinevirtual |
Returns the name of the process.
Note that the name must be a valid identifier in Python once the spaces are replaced by underscores. Also, all underscore in the name will be replaced by spaces for user presentation.
Implements mgx::process::Process.
|
virtual |
Implementation of the process with generic arguments.
The number of arguments is guaranteed to be at least as many as the ones named in the process.
Implements mgx::process::Process.
bool mgx::process::MeshExport::operator() | ( | Mesh * | mesh, |
const QString & | filename, | ||
const QString & | type, | ||
bool | transform | ||
) |
Export a mesh.
mesh | Mesh to be exported |
filename | File to save the mesh into |
type | Type (format) of the export. |
transform | Save the transformed positions |
|
inlinevirtual |
Purely for GUI purposes, provides for some of the parms parameter a choice.
In this case, the user will be presented with a combo box presenting the provided list. Note that no mechanism forces the user to choose one of this choice.
Reimplemented from mgx::process::Process.
|
inlinevirtual |
List of parameters descriptions.
There must be as many parameters than defaults.
Reimplemented from mgx::process::Process.
|
inlinevirtual |
List of named parameters.
There must be as many parameters than defaults.
Implements mgx::process::Process.