Code covered by the BSD License  

Highlights from
Matlab mesh to PDF with 3D interactive object

4.5

4.5 | 12 ratings Rate this file 75 Downloads (last 30 days) File Size: 11.2 MB File ID: #25383
image thumbnail

Matlab mesh to PDF with 3D interactive object

by

 

22 Sep 2009 (Updated )

Export triangulated mesh into a pdf with a 3D interactive object.

| Watch this File

File Information
Description

Export triangulated mesh into a pdf with a 3D object. The matlab mesh is converted to IDTF with matlab code. The IDTF file is converted to u3d with an external binary file. The u3d file can then be embedded into a pdf with pdflatex and the movie15 package. The user can then interact with the mesh (zoom, rotate etc.) from adobe reader. The package contains demo data and example of output.

The code of the IDTF to U3D converter can be obtained at : http://sourceforge.net/projects/u3d/
or in a nicely repackaged version from http://sourceforge.net/projects/mathgl/files/
thanks to Michail Vidiassov.

The toolbox has been tested on mac intel, linux and windows.

To test run the script : demo_mesh2pdf.m

Acknowledgements

Verbatim: Get The Text Of A Block Comment. inspired this file.

This file inspired Generate U3 D Files From Stl Models For Making Multilayer 3 D Pdf Figures.

MATLAB release MATLAB 7 (R14)
Other requirements The demo script requires the pdflatex command. On windows it is assumed that you have MikTex 2.8 installed.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (23)
14 Oct 2014 Roland

Hey guys!

Have also problems with the IDTFConverter. It exits with 'Exit code = 80000003'. Also tried from terminal.

May some people have a solution?
:p

Thanks!

I'm working on Ubuntu 12.04 with MatlabR2013a (64-bit)

greetings
Roland

20 Nov 2013 Sander

This is a very helpful project. Surfaces are neatly exported. However, when I plot lines, the IDTF to U3D converter gives an error. Any suggestions?

12 May 2013 Athanassios Alexiou

Good job !!

03 Mar 2013 Nuen-tsang

Hi Jeroen,

Regarding to a post you made for mesh2pdf, you said

"After some trouble shouting I fixed my first "problem" :) The input string in Matlab did not work (correctly)."

What do you mean? I study the codes for a while, i still cannot get the u3d file. By the way,

I got the download link from the forum (last post, 2012-4-12)
http://sourceforge.net/projects/u3d/forums/forum/557102/topic/3424219

download link: http://www2.iaas.msu.ru/tmp/u3d/u3d-1.2.852.tgz

Somehow i can't install Universal 3D Sample Software from http://sourceforge.net/projects/u3d/ on my MAC, (Lion, 10.7.5). With the link from the forum, i can use cmake .; make; make install to install it. I don't know is it the correct way to install. And should i keep the original file i downloaded from the forum?

Thanks.

Matt

19 Oct 2012 Chet

I tried the demo_mesh2pdf.m and it worked after downloading MikTex. Only thing is that it produces letter size pdf. I would like to create a screen size pdf so that it can be used as presentation slide. I tried changing default paper format in MikTex setting to screen but the output pdf was letter. Has anybody figured out any workaround to change paper size?
Otherwise, excellent tool.

13 Apr 2012 Steeve AMBROISE

Hi all,

I have the same question than Jeroen: i want to incorporate multiple meshes in 1 figure but I only have the last mesh. Can you help me please.

Thank you

02 Apr 2012 Jeroen

Hi again,

After some trouble shouting I fixed my first "problem" :) The input string in Matlab did not work (correctly).

I now have another question: is it possible to incorporate multiple meshes in 1 figure? And is it possible to incorporate several "stand alone" 3D (x,y,z,) points that are located on the mesh (like electrodes on the brain)?

Thanks in advance!

01 Apr 2012 Jeroen

Hi all,

I am running the scripts on max os x and get the same exit code as "bee" does. No .u3d file is made or saved, so consequently the file can not be loaded in Latex. This is when using either the .m file or Terminal.

What could be the issue? And what do you mean with "compiled the u3d converter myself" bee?

07 Oct 2011 bee

Hej igen,

I now compiled the u3d converter myself and now suddenly it works!
:)

07 Oct 2011 bee

Thanks for your answer, but it is still not working. I tried running it in terminal and get

>> ./IDTFConverter -input mesh.idft -output mesh.u3d -debuglevel 0

Input file name = mesh.idft
Output file name = mesh.u3d
Profile = 0
Scaling factor = 1.000000
Debug level = 0
Position Quality = 1000
Texture Coordinate Quality = 1000
Normal Quality = 1000
Diffuse Color Quality = 1000
Specular Color Quality = 1000
Geometry Default Quality = 1000
Texture Quality = 100
Animation Quality = 1000
Zero Area Faces Removal = ENABLED
Zero Area Face Tolerance = 0.000012
Exclude Normals = FALSE
Export Option Flags = ffff
Texture size limit = 0

Exit code = 80000003

the mesh.idtf is created with your code, I have not changes anything, only MACI to MACI64.

Thanks for your support!
Emanuel

01 Oct 2011 Alexandre Gramfort

I also use mac os x lion and it runs fine. From the mesh2pdf folder, run demo_mes2pdf. It should work.

30 Sep 2011 bee

Hej I have a problem.
I am trying to run your program on a mac64 with os lion. Unfortunately the program exist with folloing statment:
nb of colors : 17
".../mesh2pdf_2/mesh2pdf/bin/maci/IDTFConverter" -input ".../mesh2pdf_2/mesh2pdf/tex/mesh.idtf" -output ".../mesh2pdf_2/mesh2pdf/tex/mesh.u3d"
Exit code = 80000003

further I wanted to as if it is also working if I want to export slice and contourslice?

Thanks in advance!

13 May 2011 Matthew  
04 May 2011 Francis Esmonde-White

Oh- another useful hint:

If you want to enable the acrobat model measurement tool (so the viewer can use a ruler to measure the distance between points in the model), you should open the pdf using adobe acrobat pro, and use the "Advanced" -> "Extend Features in Acrobat Reader" menu item to enable extra options in the final pdf.

04 May 2011 Francis Esmonde-White

Many thanks to the author for this very useful file exchange submission!

It takes a fair bit of effort to get this submission working, but it does work. I have included detailed steps below to simplify the process for others. The demo results aren't beautiful, but at least it is possible to generate a 3D pdf from matlab.

The only other way I have found for making 3D pdf's out of arbitrary STL files is using meshlab (free) to convert an STL to a U3D file, then adobe acrobat 9 pro to insert the U3D as a 3D object. However that only allows 1 mesh layer and is really ugly (you also need acrobat pro).

Steps for getting this working on my system (Windows Vista Ultimate, Matlab R2011a):
1. download/unpack archive for mesh2pdf.
2. download/install MiKTeK 2.8 (http://miktex.org/2.8/setup)
3. open mesh2pdf_2.0\mesh2pdf\demo_mesh2pdf.m in matlab editor.
4. update lines 16-23 to point to the directory where MiKTeK is installed. Note: you might need to include quote marks to allow spaces in the path. For example...
pdflatex_cmp = ['"C:\Program Files\MiKTeX 2.8\miktex\bin\pdflatex.exe"'];

5. Go to MiKTeK directory and make all files editable by the current windows user. (Right click MiKTeK 2.8 folder, select permissions -> select current user -> check 'allow' for all Permissions -> hit apply)
6. Run mesh2pdf_2.0\mesh2pdf\miktex-update.exe to update packages.
7. Install movie15 package for MiKTeK. Run mesh2pdf_2.0\mesh2pdf\mpm.exe, scroll to movie15, right click on the movie15 item and select '+install'. (Also see http://docs.miktex.org/faq/packages.html for more information)
8. With the matlab working directory (current folder) set to the mesh2pdf_2.0\mesh2pdf directory, run the demo_mesh2pdf.m script. It will call the pdflatex command 3 times and generate a pdf file with a 3D model (I think it's a brain). The demo pdf will be in the mesh2pdf_2.0\mesh2pdf\tex directory.

14 May 2010 Roland Pfister  
29 Mar 2010 Daniel  
18 Jan 2010 Petr Pleyer

Hello,
3D pdf with this object looks great. I would like to apply the program on my own mesh model from Matlab. But when i changed "sample data" in demo_mesh2pdf.m and in directory, nothing has changed in the resulting pdf. What should change?

thx and sorry for my English :-)

14 Oct 2009 Stan Durrleman

Works fine. But you must run Matlab in command-line mode and check beforehand that you have the rights to run the scripts (IDTFConverter in the folder 'u3d'): chmod is your friend...

01 Oct 2009 Cristian D

well....finaly it works!!!!!

To add the packages (after movie15 the application ask for others) is necessary to unpack all zips on a directory, then go to MikTex Settings and, on "root" option, add the directory where the zip were unpacked, click accept and after that the programs works great.

To read the pdf is necessary you need to have at least an acrobat 9.0...

01 Oct 2009 Cristian D

Ok, i'm making some progress installing this tool. I have installed MikTex 2.8 and added '\miktex\bin' to path.
The program ask me for movie15 package.
I went to package manager of MikTex and I tried to install it. But, my work conection to internet is filtered and i can't install the package from intenet, so I tried to do it chossing the option (on MikTex) "repositories shall be installed from directory" and I select a directory where i have downloaded the movie15.zip (537kb). The aplication returns "directorie does seem to be a local package repository".
How can i install movie15 package? Have I the correct package? why MixTex Package manager doesn't recognize the zip?
Thanks.
Regards,
Cristian

30 Sep 2009 Alexandre Gramfort

it means that the demo script cannot find the pdflatex.exe command.

On my windows I have MikTeX 2.8. So update the path in the demo script or install MikTeX 2.8

29 Sep 2009 Cristian D

What versiĆ³n of acrobat I should use? i have v8 professional and your programa doesn't work. I recive the following error:

Warning: Name is nonexistent or not a directory: C:\Program Files\MiKTeX2.8\miktex\bin.
> In path at 110
In addpath at 87
In demo_mesh2pdf at 21
"pdflatex.exe" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable.

Updates
28 Sep 2009

- fix minor bug on windows
- removing useless files in zip

10 Jan 2010

For windows users, this version does not require anymore to have meshlab installed.

Contact us