3D PDF

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

3D PDF

Post by chrisb »

I have successfully created a 3D PDF and would like to share the procedure here. The idea and the meshlab script are from http://home.arcor.de/mnumberger/cad-stlto3dpdf.html

Prerequisits:
  • Meshlab
  • latex with package media9
The following steps delivered a 3D PDF, which can be opened e.g. with acrobat reader.
  • Extract the contents of the attached zip to somefolder.
  • Export the object as Mesh (extension .stl) into that folder, let's say the filename is somefolder/object3D.stl.
  • In that folder call

    Code: Select all

    meshlabserver -i object3D.stl -o object3D.u3d -s remove_duplicate_faces_vertex.mlx -om vq fq wn
    
    On my system it crashes but before doing so it created the u3d file object3D.u3d. It creates a latex file as well, but that didn't work for me, so I wrote a new one: pdf3d.tex.
  • If you want to change the intermediate filename from object3D.u3d to something else, you have to adapt it in the latex file pdf3d.tex as well.
  • call latex:

    Code: Select all

    pdflatex pdf3d
    pdflatex pdf3d
    
    Yes, you have to latex twice to fulfill some internal references, without them the pdf didn't show the 3D object.
  • You are done, the result is pdf3d.pdf
Attachments
pdf3d.zip
(911 Bytes) Downloaded 991 times
pdf3d.pdf
(42.03 KiB) Downloaded 1692 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: 3D PDF

Post by easyw-fc »

Hi @chrisb
if you can use a windows pc, here an alternative method that can give you also colors on the 3D pdf
https://forum.freecadweb.org/viewtopic. ... 97#p144530
some more tips here
https://forum.freecadweb.org/viewtopic. ... 97#p144546
from the 3Dpdf you can also extract U3D data and embed that in a new pdf using LaTex

the best imo it would be to have a script to export a FC solid model to U3D or better PRC and then run Asymptote (fully open source) to generate the 3D pdf... but unfortunately nothing has been developed on this side atm...

Maurice
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: 3D PDF

Post by chrisb »

Direct export would be great. I was surprised that there are not many viewers out there, which can display one of the standard (or better: de-facto-standard) formats like STEP, STL, or OBJ or alike.
When I recently discovered 3DPDF I thought it was the end of the "Show and Tell" problems, because the Acrobat reader is widely used. But here we have the problem that it is difficult to generate the target format. So there seems to be not much desire to only view 3D files.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: 3D PDF

Post by NormandC »

Hi Chris,

Impressive! Unfortunately I know of no way to view 3D PDFs on Ubuntu. It looks like there is no more Linux version available of Adobe Reader, there's only an Android one.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: 3D PDF

Post by bernd »

NormandC wrote:Impressive! Unfortunately I know of no way to view 3D PDFs on Ubuntu. It looks like there is no more Linux version available of Adobe Reader, there's only an Android one.
+1, AFAIK there is no software on Linux which can handle 3D pdf. We use it widely at work because any Customer has an AdobeReader but lot's do not know about ifc (building model format) and do not have an viewer for this file format. This will change but at the moment 3Dpdf is still mostly used.
User avatar
r-frank
Veteran
Posts: 2180
Joined: Thu Jan 24, 2013 6:26 pm
Location: Möckmühl, Germany
Contact:

Re: 3D PDF

Post by r-frank »

bernd wrote:AFAIK there is no software on Linux which can handle 3D pdf
Well, yes and no ;)

Adobe has dropped Support, but you can still find ubuntu-packages on the net, see here (2nd post).

A german howto-install for Linux mint i found here ...
Deutsche FreeCAD Tutorials auf Youtube
My GrabCAD FreeCAD-Projects
FreeCAD lessons for beginners in english

Native german speaker - so apologies for my english, no offense intended :)
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: 3D PDF

Post by bernd »

r-frank wrote:
bernd wrote:AFAIK there is no software on Linux which can handle 3D pdf
Well, yes and no ;)

Adobe has dropped Support, but you can still find ubuntu-packages on the net, see here (2nd post).

A german howto-install for Linux mint i found here ...
Yes I know, I have installed ut ondebian jessie, but it is really outdated, no longer maintained and has AFAIK security issues.
chrisb
Veteran
Posts: 54197
Joined: Tue Mar 17, 2015 9:14 am

Re: 3D PDF

Post by chrisb »

NormandC wrote:Hi Chris,

Impressive! Unfortunately I know of no way to view 3D PDFs on Ubuntu. It looks like there is no more Linux version available of Adobe Reader, there's only an Android one.
I found an old version which I was able to install, but of course I would like to have an open software displaying 3D PDF.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: 3D PDF

Post by wmayer »

With mathgl it is also possible to create directly 3d pdf files and it is supposed to support a certain mesh format. So, when writing out a mesh in FreeCAD in this format it theoretically should be possible to create a 3d pdf file without the need of pdflatex or the idtf converter. Unfortunately, after trying several hours I couldn't get it to work.

Another very promising alternative is the library libPRC. This way you can write out a mesh in the prc format (which is the successor of the deprecated u3d format) and then using the libharu library the prc file can be embedded into a pdf file.
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: 3D PDF

Post by easyw-fc »

wmayer wrote: Thu Aug 10, 2017 8:22 pm With mathgl it is also possible to create directly 3d pdf files and it is supposed to support a certain mesh format. So, when writing out a mesh in FreeCAD in this format it theoretically should be possible to create a 3d pdf file without the need of pdflatex or the idtf converter. Unfortunately, after trying several hours I couldn't get it to work.

Another very promising alternative is the library libPRC. This way you can write out a mesh in the prc format (which is the successor of the deprecated u3d format) and then using the libharu library the prc file can be embedded into a pdf file.
Have you succeed with libPRC and libharu? Not a must but an other nice feature to have an option to export FC file to 3dpdf ...
Post Reply