File Format FCStd: Difference between revisions

From FreeCAD Documentation
mNo edit summary
(The Document.xml and GuiDocument.xml are at the root of the archive, together with any number of .brp (BREP) files. One subdirectory may hold the thumbnail, and another the SVG templates used by TechDraw.)
(37 intermediate revisions by 9 users not shown)
Line 1: Line 1:
<languages/>
A FreeCAD project is actually a normal zip file that always contains a Document.xml file and optionally several data files, a GuiDocument.xml and a thumbnail in PNG format.
{{TOCright}}
<translate>
==Overview== <!--T:1-->
The '''FreeCAD Standard file format''' ({{FileName|.FCStd}}) is FreeCAD's main file format. It is a compound format, supports compression and embedding of different kinds of data.


== Internals of .FCStd files == <!--T:5-->
==Structure of Document.xml==

<!--T:14-->
FCStd is a [[#Contents | standard zip file containing one or more files]] in a [[#structure |specific structure]]. As such, it is possible to unpack a {{FileName|.FCStd}} file using a regular zip decompression tool, but care needs to be taken while packing the contents of a {{FileName|.FCStd}} file. FreeCAD contains a "Project Utility" to re-pack {{FileName|.FCStd}} files, it's use is described in [[#Change the source of the file .FCStd|Change the source of the file .FCStd]] below.

===Document.xml=== <!--T:15-->

<!--T:25-->
This is the main {{FileName|.xml}} file describing all the objects inside a FreeCAD document, that is, only the geometric and parametric definition of the objects, not their visual representation. If FreeCAD is ran in console mode (without the GUI), only this {{FileName|Document.xml}} will be used.

==== Example Document.xml==== <!--T:16-->

</translate>
{{Code|lang=xml|code=
<?xml version='1.0' encoding='utf-8'?>
<?xml version='1.0' encoding='utf-8'?>
<!--
<!--
Line 93: Line 110:
</ObjectData>
</ObjectData>
</Document>
</Document>
}}
<translate>

===GuiDocument.xml=== <!--T:6-->

<!--T:26-->
This is the GUI counterpart of the {{FileName|Document.xml}} file. For each object described in the {{FileName|Document.xml}}, there is one corresponding object in {{FileName|GuiDocument.xml}}, describing the visual representation of that object (color, linewidth, etc).

===Thumbnails/thumbnail.png=== <!--T:7-->

<!--T:27-->
This is a 128x128 pixels thumbnail image of the document, which is a screenshot of the 3D view at save time. Thumbnails are generated only if the corresponding option is enabled in the FreeCAD preferences.

===Templates/*.svg=== <!--T:8-->

<!--T:28-->
In the Templates folder are stored the template svg files used in [[Drawing Module|Drawing]] pages.

===*.brep=== <!--T:9-->

<!--T:29-->
These are the [[wikipedia:Boundary representation|B-rep]] shapes of all objects that have a Part shape in the {{FileName|Document.xml}}. Each object, even if it is parametric, has its shape stored as an individual {{FileName|.brep}} file, so it can be accessed by components without the need to recalculate the shape.

===Typical structure=== <!--T:17-->

<!--T:30-->
Structure of a typical {{FileName|.FCStd}} file. The extension can be changed to {{FileName|.zip}} to explore it like a normal directory. The {{FileName|Document.xml}} and {{FileName|GuiDocument.xml}} are at the root of the archive, together with any number of {{FileName|.brp}} (BREP) files. One subdirectory may hold the thumbnail, and another the SVG templates used by [[TechDraw_Workbench|TechDraw]].

</translate>
<!--DO NOT remove the <pre> </pre> tags. These are used to display the text exactly like this.-->
<pre>
File.FCStd (File.zip)
|
:--thumbnails/
|
:--Thumbnail.png
|
:--Templates/
|
:--MyPage.svg
|
:--Document.xml
:--GuiDocument.xml
:--Shape1.brp
:--Shape2.brp
:--etc.
</pre>
<translate>

==Change the source of the file .FCStd== <!--T:3-->

<!--T:4-->
* See [[Std_ProjectUtil|Std ProjectUtil]].

==Other== <!--T:10-->

<!--T:11-->
* A file Converter utility [[ImageConv|ImageConv]].


</translate>
{{languages | {{es|File_Format_FCStd/es}} }}
{{Userdocnavi{{#translation:}}}}
[[Category:Formats{{#translation:}}]]
[[Category:Developer{{#translation:}}]]
[[Category:Developer Documentation{{#translation:}}]]
{{clear}}

Revision as of 23:42, 9 May 2020

Overview

The FreeCAD Standard file format (.FCStd) is FreeCAD's main file format. It is a compound format, supports compression and embedding of different kinds of data.

Internals of .FCStd files

FCStd is a standard zip file containing one or more files in a specific structure. As such, it is possible to unpack a .FCStd file using a regular zip decompression tool, but care needs to be taken while packing the contents of a .FCStd file. FreeCAD contains a "Project Utility" to re-pack .FCStd files, it's use is described in Change the source of the file .FCStd below.

Document.xml

This is the main .xml file describing all the objects inside a FreeCAD document, that is, only the geometric and parametric definition of the objects, not their visual representation. If FreeCAD is ran in console mode (without the GUI), only this Document.xml will be used.

Example Document.xml

<?xml version='1.0' encoding='utf-8'?>
 <Document SchemaVersion="4">
    <Properties Count="9">
       <Property name="Comment" type="App::PropertyString">
          <String value=""/>
       </Property>
       <Property name="Company" type="App::PropertyString">
          <String value=""/>
       </Property>
       <Property name="CreatedBy" type="App::PropertyString">
          <String value=""/>
       </Property>
       <Property name="CreationDate" type="App::PropertyString">
          <String value="Fri Jan 29 15:14:38 2010 "/>
       </Property>
       <Property name="FileName" type="App::PropertyString">
          <String value="/tmp/test.FCStd"/>
       </Property>
       <Property name="Id" type="App::PropertyString">
          <String value="201b746f-a1ed-4297-bf3d-65d5ec11abe0"/>
       </Property>
       <Property name="Label" type="App::PropertyString">
          <String value="names"/>
       </Property>
       <Property name="LastModifiedBy" type="App::PropertyString">
          <String value=""/>
       </Property>
       <Property name="LastModifiedDate" type="App::PropertyString">
          <String value="Fri Jan 29 15:15:21 2010 "/>
       </Property>
    </Properties>
    <Objects Count="2">
       <Object type="Mesh::Cube" name="Cube" />
       <Object type="Part::Box" name="Box" />
    </Objects>
    <ObjectData Count="2">
       <Object name="Cube">
          <Properties Count="7">
             <Property name="Height" type="App::PropertyFloatConstraint">
                <Float value="10"/>
             </Property>
             <Property name="Label" type="App::PropertyString">
                <String value="Cube"/>
             </Property>
             <Property name="Length" type="App::PropertyFloatConstraint">
                <Float value="10"/>
             </Property>
             <Property name="Mesh" type="Mesh::PropertyMeshKernel">
                <Mesh file="MeshKernel.bms"/>
             </Property>
             <Property name="Placement" type="App::PropertyPlacement">
                <PropertyPlacement Px="0" Py="0" Pz="0" Q0="0" Q1="0" Q2="0" Q3="1"/>
             </Property>
             <Property name="Pos" type="App::PropertyPlacementLink">
                <Link value=""/>
             </Property>
             <Property name="Width" type="App::PropertyFloatConstraint">
                <Float value="10"/>
             </Property>
          </Properties>
       </Object>
       <Object name="Box">
          <Properties Count="7">
             <Property name="Height" type="App::PropertyLength">
                <Float value="10"/>
             </Property>
             <Property name="Label" type="App::PropertyString">
                <String value="Box2"/>
             </Property>
             <Property name="Length" type="App::PropertyLength">
                <Float value="10"/>
             </Property>
             <Property name="Placement" type="App::PropertyPlacement">
                <PropertyPlacement Px="0" Py="0" Pz="0" Q0="0" Q1="0" Q2="0" Q3="1"/>
             </Property>
             <Property name="Pos" type="App::PropertyPlacementLink">
                <Link value=""/>
             </Property>
             <Property name="Shape" type="Part::PropertyPartShape">
                <Part file="PartShape.brp2"/>
             </Property>
             <Property name="Width" type="App::PropertyLength">
                <Float value="10"/>
             </Property>
          </Properties>
       </Object>
    </ObjectData>
 </Document>

GuiDocument.xml

This is the GUI counterpart of the Document.xml file. For each object described in the Document.xml, there is one corresponding object in GuiDocument.xml, describing the visual representation of that object (color, linewidth, etc).

Thumbnails/thumbnail.png

This is a 128x128 pixels thumbnail image of the document, which is a screenshot of the 3D view at save time. Thumbnails are generated only if the corresponding option is enabled in the FreeCAD preferences.

Templates/*.svg

In the Templates folder are stored the template svg files used in Drawing pages.

*.brep

These are the B-rep shapes of all objects that have a Part shape in the Document.xml. Each object, even if it is parametric, has its shape stored as an individual .brep file, so it can be accessed by components without the need to recalculate the shape.

Typical structure

Structure of a typical .FCStd file. The extension can be changed to .zip to explore it like a normal directory. The Document.xml and GuiDocument.xml are at the root of the archive, together with any number of .brp (BREP) files. One subdirectory may hold the thumbnail, and another the SVG templates used by TechDraw.

File.FCStd (File.zip)
  |
  :--thumbnails/
     |
     :--Thumbnail.png
  |
  :--Templates/
     |
     :--MyPage.svg
  |
  :--Document.xml
  :--GuiDocument.xml
  :--Shape1.brp
  :--Shape2.brp
  :--etc.

Change the source of the file .FCStd

Other