import PRC file or 3D PDF into FreeCAD #6090
Labels
Mod: Core
Issue or PR touches core sections (App, Gui, Base) of FreeCAD
Type: Feature
FR for improvements or new features
Issue imported from https://tracker.freecad.org/view.php?id=4403
Original report text
This is a follow up the suggestion I made in the forum.
PRC files are commonly used by several vendors to embed 3D models in a PDF file. Unfortunately, these files can only be opened with Adobe PDF reader. For example, Linux does not have a native Adobe viewer, which means it is impossible to view correctly this type of documents. One needs some workarounds (Wine, Virtualbox, or old Adobe versions for Linux).
I thought that in general, not only for Linux users, it would be nice if FreeCAD would be able to import PRC files in the same way it imports STEP files. (Also including nested parts in the tree model).
It is easy to extract the embedded PRC file from the 3D PDF, by just searching for 'stream.PRC' and 'endstream' bytes in a hex editor, so in principle this could be done automatically also by FreeCAD. Everything inbetween is the PRC binary file that can be extracted, and for example included in your own PDF with pdflatex media9 package.
Thinking about a 'far future', if FreeCAD is able to open and import it, this would allow in the future that Linux PDF viewers display inline also 3D models, by embedding a small FreeCAD plugin directly, instead of having to open it in external FreeCAD window. In the same way than Adobe PDF reader has a Flash Player plugin to do that.
To implement this feature, one might reuse some parts of this code: https://github.com/XenonofArcticus/libPRC
The PRC file format is defined here.
Other posts related to generating PRC files from a FreeCAD model:
https://forum.freecadweb.org/viewtopic.php?t=20224&start=10
https://forum.freecadweb.org/viewtopic.php?f=8&t=18497#p144546
(This is the opposite direction than the feature requested here)
Steps to reproduce
(Side note: if a 3D PDF file has several 3D models embedded, this has to be done in a for loop. Or the user has to select in the import dialog one among those)
%
%
FreeCAD Info
Other bug information
Discussion from Mantis ticket
Comment by ferdymercury 2020-07-08 14:13
The following link is more updated than the one from libPRC I posted before.
https://github.com/vectorgraphics/asymptote/tree/50fb809fdaf2383385f09884174262964a046156/prc
One could expand the code in asymptote repository and write the functions in the opposite direction (Deserialize, Read) instead of (Serialize, Write). So that Asymptote library could be used as an 'intermediary'. Then, one would 'only' need to convert Asymptote structure to FreeCAD structure.
See also:
https://forum.freecadweb.org/viewtopic.php?t=156
Comment by wmayer 2020-12-10 16:49
https://forum.freecadweb.org/viewtopic.php?f=8&t=53116
Comment by ferdymercury 2020-12-10 16:54
See also: vectorgraphics/asymptote#167
The text was updated successfully, but these errors were encountered: