View Issue Details

IDProjectCategoryView StatusLast Update
0004403FreeCADFeaturepublic2020-07-08 15:43
Reporterferdymercury Assigned To 
Status newResolutionopen 
Product Version0.20 
Summary0004403: import PRC file or 3D PDF into FreeCAD
DescriptionThis 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:

The PRC file format is defined [url=]here[/url].

Other posts related to generating PRC files from a FreeCAD model:
(This is the opposite direction than the feature requested here)
Steps To Reproduce
  • Download
  • Open it with Bless hex editor or equivalent
  • Search for PRC keyword (search option Text, not Hex).
  • Select and delete in the hex editor from beginning of document until & including line above, containing keyword 'stream', so that first three bytes of the resulting file are 'PRC'.
  • Search for 'endstream' keyword. Delete from (including) this line until the end of the document.
  • Save result as .prc
  • In a Latex document, you can include it with
      %label=dice, % name for referencing 3D object
      %3Dcoo=13.514159202575684 -210.37330627441406 265.50933837890625,
      %3Dc2c=-0.6669085025787354 0.39916229248046875 0.6292078495025635,
  • Compile with pdflatex, and open it with Adobe PDF Reader

(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)
Tagsconversion, file format, import, STEP
FreeCAD InformationOS: Linux Mint 19.3 (MATE/mate)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21775 (Git) AppImage
Build type: Release
Branch: master
Hash: 1f741aa511e898849e46ed14515fce416fe32acb
Python version: 3.8.2
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)



2020-07-08 14:13

reporter   ~0014636

The following link is more updated than the one from libPRC I posted before.

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:

Issue History

Date Modified Username Field Change
2020-07-08 13:54 ferdymercury New Issue
2020-07-08 13:57 ferdymercury Tag Attached: STEP
2020-07-08 13:58 ferdymercury Tag Attached: file format
2020-07-08 13:58 ferdymercury Tag Attached: conversion
2020-07-08 14:13 ferdymercury Note Added: 0014636
2020-07-08 15:43 Kunda1 Tag Attached: import