How can I compose several xml-vtk files (vtu, vti) into one to get an animation? - visualization

I have a simulation which produces a bunch of vtu (also pvtu) and vti (also pvti) files which, as I understand, represent the configuration of points in one timestamp. But is there a way to group them into one close-to-vtk file to be able to visualize a simulation, which consists of many timestamps, in an app like paraview (but not only)?

ParaView can natively open many files as a time series, see the doc.
If your file names contains a number, the ParaView "open file" dialog will collapse them under a dummy filename containing dots instead of number. Open it to open the whole series.
edit: conversion
To be close to the vtk format, you may use .pvd that is a ParaView format described here or the .series from VTK (doc here )
To read it with another software, well, you will need to check the supported file formats by the application you want to use. VTK can write several other formats, including Exodus, XDMF or CGNS for instance.

Related

How to convert las file to ply file?

I want to open my 3D point cloud in MATLAB. But they are in .las files. How can I display them in MATLAB???
I heard about .ply file can open 3D point data on MATLAB. So I want to know how to convert las files to ply files.
There is a .las file reader for matlab here:
https://es.mathworks.com/matlabcentral/fileexchange/48073-lasdata
Once you have the data in matlab you can use these point cloud tools, which are part of the computer vision toolbox:
https://es.mathworks.com/help/vision/3-d-point-cloud-processing.html
If you want to embrace the open source force, I'm writing a Python (easy transition from matlab) library for point cloud processing:
https://github.com/daavoo/pyntcloud
You can use the free and open-source CloudCompare software.
On the command line:
CloudCompare -O file_to_convert.las -C_EXPORT_FMT PLY -SAVE_CLOUDS
Take care to the order of the options: it seems that -SAVE_CLOUDS must be at the end.
That will result in a binary-format PLY file in the same directory as the file to convert, named using the original filename and the date of export, like: file_to_convert_2019-07-18_13h32_06_751.ply
I found no way to specify the output file name (should you find one please comment below).
Should you want a more predictable name, add option -NO_TIMESTAMP before the option -SAVE_CLOUDS (but then you risk overwriting files so be careful).
More help (such as how to export in ASCII-format) in the documentation.
I timed this on powerful PC, it took 170s to convert a 2.7GB LAS file with 102M points (XYZ,intensity,time).
if you have LAStools installed, you can use las2txt to convert your *.las/*.laz files into *.xyz format which MeshLab can import natively as a point cloud, which may then be converted into a Mesh.
There are a multitude of caveats to that depending on the source of your data-set.

How to read Ansys data files in ParaView?

Anybody knows how to export an Ansys structural data file to ParaView?
It is read that ParaView has an Ansys reader, but it does not work. Errors always come up when loading the *.inp file.
Is there any script to convert .inp files to .vtk?
Thanks
Based on the video from Czech-based SVS FEM s.r.o., I wrote an input file for Ansys Mechanical APDL, that creates a VTK file, which can be opened in ParaView.
In the input file vtk.inp, the user has to specify the argument arg1, for which the nodal values are to be written to the vtk file via the command *get,my_results(j),NODE,n_j,..., p.e.
arg1='S,EQV' ! for equivalent stress or
arg1='TEMP' ! for temperature
For further nodal results, refer to the specifications of the *GET command in the Ansys Commands Reference.
The vtk.inp file should be placed in the current working directory. It is called with the APDL command /input,vtk,inp. In Ansys Mechanical, this command can directly be inserted in the command line. In Ansys Workbench, the command can be pasted in the feature Commands (APDL) under Solution.
The output file output.vtk is written in the same location as the input file.
The code was tested with a structural analysis in Ansys Mechanical APDL 17.2 and Ansys Workbench 17.2. The vtk file was tested with ParaView 5.4.1.
Explanation:
The array e_types_Ansys_to_VTK maps the Ansys element types (p. e. SOLID186) to VTK cell types (see also Ansys Element Types).
Limitations:
The input file is yet limited to write only one scalar parameter result in the vtk file, but it can easily be extended for vector or tensor results as well as for multiple results in one vtk file, following the VTK File Format Specification.
Since Ansys stores nodal results only in the corner nodes, only linear VTK elements are used. There could still be some minor mistakes in the e_types_Ansys_to_VTK map, since I could only test some element types. Please feel free to report any corrections or extensions to the code in the comments.
Here is the link to the source code. Use at your own risk.
In case you would like to export a vtk file directly from Ansys Workbench, a Python result converter was introduced in a Youtube video here. Unfortunately, the source code only appears in the video and is explained in Czech language.
Thus, I typewrote the code from screenshots and made some minor improvements.
You will need two files to install the macro as an Ansys ACT extension:
main.py and vtk.xml.
Place the file vtk.xml in the folder C:\Program Files\ANSYS Inc\v###\Addins\ACT\extensions, where ### is your Ansys version, p.e. 172
Create a new folder vtk in C:\Program Files\ANSYS Inc\v###\Addins\ACT\extensions.
Place the file main.py in the created folder.
Start Ansys Workbench.
Register the path C:\Program Files\ANSYS Inc\v###\Addins\ACT\extensions as additional extension path under Tools > Options > Extensions.
Restart Ansys Workbench, go to Extensions > ACT start page > Extension manager > VTK and load the extension.
In a structural analysis, go to Results, right-click and insert My results. Three inputs have to made by the user:
Under *get,my_results(j),NODE,N,..., , give the desired nodal result according to the Ansys Commands Reference, p.e. S,EQV for equivalent stress.
Under VTF file name, give the full path to the vtk output file to be created, p.e. C:\temp\output.vtk
Under Load step, give the load step number (p.e. 1 for last load step unless not stated otherwise).
For larger models, I experienced that the automatically generated file makeresult.mac is not instantly transferred from the project_pending folder to the actual working directory, thus, causing the macro to throw an error. Maybe, anyone can make a suggestion on how to fix this?
ParaView cannot read .inp structure files (I guess this is the Abaqus file format). You could try to export your files as Nastran (.nas) files, since ParaView has a Nastran reader.

Xlsread returning zero values....?

I am getting zero values while using xlsread command in MATLAB.I am using a real world dataset taken from UCI repository which has got both integer and float values.
[Train,textData,rawData] = `xlsread('C:\Users\pooja\Documents\project\breastcancer.csv');`
I have tried with xls format too..
[Train,textData,rawData] = xlsread('C:\Users\pooja\Documents\project\breastcancer.xls');
Thanx in Advance..!
In the wide world of computers, there are a lot of data formats. You need to remember that data formats are different from each other. Generally software like Matlab allows you to open different types of data formats. Each one of course with its own function.
You can guess that the function xmlread is to read XML files. If you want to read csv files or any other type of file in the world, please (I think this is obvious) do not use xmlread!
Specifically to open csv files matlab has csvread. Please, do not use csv read to open files that are not CSV.....

Writing to complex PDF's in MATLAB

I'm trying to write a MATLAB function that processes a file and writes a report on that file. The report will contain numbers, strings, tables, and images.
After looking at MATLAB's documentation, I can only find functions that save individual items to a file. For example, print saves a plot, write saves a table, etc. How do I create a single file that contains many of these items (e.g. a PDF with images, tables, and text)?
You can use print with the -append option to write multiple pages to a PostScript file in sequence, and then convert the ps to pdf. Using Matlab's handle graphics system, it is possible (if tedious) to design each print page in detail, arrange elements, etc.
However, if your document is going to be really complex, I think it would be better to generate the pdf in another way. One approach would be to write LaTeX code using lots of fprintfs and compile the file using pdflatex.
Btw., I'm not aware of a Matlab function write that generates a pdf.

Create Numbers file and open it with Numbers on iPad

I would like to do a task that is quite simple on other OS, but it is not so trivial on iOS. Namely, I want to create file and open it in Numbers.
I can preview the file with UIDocumentInteractionController and then offer it to user that he/she opens it.
THis seems to me quite a reasonable solution. However, I need to offer proper file format. I suppose CSV and XLS would be reasonable to implement and it would most probably work, but I would still like to do it in native Numbers format if possible. However, I can't find any info about this file format.
Basically, this task is about exporting data to another app and then working further with them.
I don't know of a library that can create native Numbers files. There are hoewever some libraries that allow creating XLS files. Since Numbers fully supports XLS, this is probably the way to go.
There is a comercial library available that might work on the iPhone (costs $200): http://www.libxl.com/
As for free XLS libraries, I only know xlwt, a Python module. You could set up a webservice that creates an XLS file for your app, using xlwt on the server side.
If you want to pass information to Numbers, you can probably also use CSV files. If you use CSV files, you must be aware of some things. There are two kinds of CSV files: the comma separated version (used in english speaking countries) and the semicolon separated (used in continental europe).
The comma separated CSV files look for example like this:
"ID","First Name","Last Name","Salary"
1,"John","Malkovich",3400.20
2,"Fred","Astaire",2000.60
The second kind of CSV files are semicolon separated and use a comma as decimal mark. They look like this:
"ID";"First Name";"Last Name";"Salary"
1;"John";"Malkovich";3400,20
2;"Fred";"Astaire";2000,60
On the Macintosh, Numbers expects a different format depending on the Region setting. If you have your Region set to the US, it will expect the first kind. If you choose Germany, it will expect the second kind.
I don't know what kind of files Numbers on the iPad expects.
Another alternative would be using copy and paste. Try to copy tab separated text into the clipboard.
I hope this may help you. I've contacted libxl team and they responded with the link to the demo version of their iPhone library: http://www.libxl.com/download/libxl-iphone.zip