File Format FCStd: Difference between revisions

From FreeCAD Documentation
m (link wikipedia)
(Marked this version for translation)
(10 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{TOCright}}
<translate>
<translate>
<!--T:1-->
==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.
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.


Line 9: Line 10:
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.
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.


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

====Document.xml====
<!--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.
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-->
==== Example Document.xml==== <!--T:16-->

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

====GuiDocument.xml==== <!--T:6-->
===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).
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-->
===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.
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-->
===Templates/*.svg=== <!--T:8-->

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


====*.brep==== <!--T:9-->
===*.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.
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.


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

Structure of a typical FCStd file:
<!--T:30-->
Structure of a typical {{FileName|FCStd}} file:

</translate>
</translate>
<!--DO NOT remove the <pre> </pre> tags. These are used to display the text exactly like this.-->
<syntaxhighlight>
<pre>
--File.fcstd
--File.fcstd
|
|
Line 140: Line 156:
--Shape2.brep
--Shape2.brep
--etc...
--etc...
</pre>
</syntaxhighlight>
<translate>
<translate>


Line 153: Line 169:


<!--T:19-->
<!--T:19-->
Create a new directory and place your copy in that directory (there may be many files in your FCStd).
* Create a new directory and place your copy in that directory (there may be many files in your FCStd).


<!--T:20-->
<!--T:20-->
* Go in Menu {{MenuCommand|Tools → Project utility... Project utility box}}
* Access the {{MenuCommand|Tools → Project utility... Project utility box}} entry from the dropdown menu.
[[File:Project utility en.png|240px]]
[[File:Project utility en.png|240px]]
* Source : Give your copy to unpack path.
* '''Source''': Give your copy to unpack path.
* Destination : Give the path to the unzipped files.
* '''Destination''': Give the path to the unzipped files.
* Click {{KEY|Extract}}
* Click {{KEY|Extract}}
* Go to your directory and open both files {{FileName|GuiDocument.xml}} andt {{FileName|Document.xml}} using [http://notepad-plus-plus.org/ Notepad++] (Windows) (Notepad++ to modify a word in all open documents).
* Go to your directory and open both files {{FileName|GuiDocument.xml}} and {{FileName|Document.xml}} using [http://notepad-plus-plus.org/ Notepad++] (Windows) (Notepad++ to modify a word in all open documents) or whatever text editor you prefer.
* {{FileName|'''GuiDocument.xml'''}} : contains all your project information to the interface, display in the Combo view, the configuration of FreeCAD . . .
* {{FileName|'''GuiDocument.xml'''}}: contains all your project information to the interface, display in the Combo view, the configuration of FreeCAD.
**Example with '''Text004'''
**Example with '''Text004'''

</translate>
</translate>
{{Code|code=
<syntaxhighlight>
<ViewProvider name="Text004">
<ViewProvider name="Text004">
<Properties Count="9">
<Properties Count="9">
Line 197: Line 214:
</Properties>
</Properties>
</ViewProvider>
</ViewProvider>
}}
</syntaxhighlight>
<translate>
<translate>


<!--T:21-->
<!--T:21-->
* {{FileName|'''Document.xml'''}} : contains all information relating to the constituent objects your project.
* {{FileName|'''Document.xml'''}}: contains all information relating to the constituent objects your project.
**Example with '''Text004'''
**Example with '''Text004'''

</translate>
</translate>
{{Code|code=
<syntaxhighlight>
<Object type="App::Annotation" name="Text004" />
<Object type="App::Annotation" name="Text004" />
}}
</syntaxhighlight>


{{Code|code=
<syntaxhighlight>
<Object name="Text004">
<Object name="Text004">
<Properties Count="3">
<Properties Count="3">
Line 225: Line 243:
</Object>
</Object>


}}
</syntaxhighlight>
<translate>
<translate>

<!--T:12-->
<!--T:12-->
* Information such as :
* Information such as :

</translate>
</translate>
{{Code|code=
<syntaxhighlight>
<VectorList file="Points1"/>
<VectorList file="Points1"/>
<ColorList file="DiffuseColor"/>
<ColorList file="DiffuseColor"/>
Line 236: Line 256:
<Part file="PartShape.brp2"/>
<Part file="PartShape.brp2"/>
. . . .
. . . .
}}
</syntaxhighlight>
<translate>
<translate>


Line 243: Line 263:
* Once the Word change is identified, '''search''' (your Word) and '''Replace by''' (your new word) and click on {{KEY|Replace in all open documents}} and your change will be the same in both files {{FileName|'''GuiDocument.xml'''}} and {{FileName|'''Document.xml'''}}.
* Once the Word change is identified, '''search''' (your Word) and '''Replace by''' (your new word) and click on {{KEY|Replace in all open documents}} and your change will be the same in both files {{FileName|'''GuiDocument.xml'''}} and {{FileName|'''Document.xml'''}}.
* When changes are complete, return to the Menu {{MenuCommand|Tools → Project utility... Create project}}
* When changes are complete, return to the Menu {{MenuCommand|Tools → Project utility... Create project}}
* Source : Give the path of the file that you just changed and that is to restore.
* '''Source''': Give the path of the file that you just changed and that is to restore.
* Destination : Give the path of the FCStd file to restore.
* '''Destination''': Give the path of the FCStd file to restore.
* Click {{KEY|...}} In the new window click on {{KEY|Create a new folder}} (to avoid errors by rewriting the file) and you post. Click on {{KEY|Create}} you can check the "Load project file after creation".
* Click {{KEY|...}} In the new window click on {{KEY|Create a new folder}} (to avoid errors by rewriting the file) and you post. Click on {{KEY|Create}} you can check the "Load project file after creation".
* If you have checked "Load project file after creation" your project will load in FreeCAD.
* If you have checked "Load project file after creation" your project will load in FreeCAD.
* '''PS :''' It is imperative that it have concordance {{FileName|GuiDocument.xml}}, {{FileName|Document.xml}} documents and files without which there will be errors in your {{FileName|.FCStd}} file. To do this should always work on a copy of your project.
* '''Note:''' It is imperative that it have concordance {{FileName|GuiDocument.xml}}, {{FileName|Document.xml}} documents and files without which there will be errors in your {{FileName|.FCStd}} file. To do this should always work on a copy of your project.


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


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


<!--T:13-->
[[Category:User Documentation]]
</translate>
</translate>
{{Userdocnavi{{#translation:}}}}
[[Category:Formats{{#translation:}}]]
[[Category:Developer{{#translation:}}]]
[[Category:Developer Documentation{{#translation:}}]]
{{clear}}
{{clear}}

Revision as of 21:02, 12 March 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:

 --File.fcstd
  |
  --Document.xml
  --GuiDocument.xml
   |
   --Thumbnails
    |
    --thumbnail.png
   |
   --Templates
    |
    --MyPage.svg
  --Shape1.brep
  --Shape2.brep
  --etc...

Change the source of the file .FCStd

ATTENTION ALWAYS WORK ON A COPY OF YOUR PROJECT !

It is possible to change the source of a file .FCStd but the procedure is not without risk it is for this reason that we need to work on a copy.

After having made an copy of your project, follow these steps :

  • Create a new directory and place your copy in that directory (there may be many files in your FCStd).
  • Access the Tools → Project utility... Project utility box entry from the dropdown menu.

  • Source: Give your copy to unpack path.
  • Destination: Give the path to the unzipped files.
  • Click Extract
  • Go to your directory and open both files GuiDocument.xml and Document.xml using Notepad++ (Windows) (Notepad++ to modify a word in all open documents) or whatever text editor you prefer.
  • GuiDocument.xml: contains all your project information to the interface, display in the Combo view, the configuration of FreeCAD.
    • Example with Text004
<ViewProvider name="Text004">
			<Properties Count="9">
				<Property name="DisplayMode" type="App::PropertyEnumeration">
					<Integer value="1"/>
				</Property>
				<Property name="FontName" type="App::PropertyString">
					<String value="Arial"/>
				</Property>
				<Property name="FontSize" type="App::PropertyFloat">
					<Float value="5.199999809265"/>
				</Property>
				<Property name="Justification" type="App::PropertyEnumeration">
					<Integer value="0"/>
				</Property>
				<Property name="LineSpacing" type="App::PropertyFloat">
					<Float value="0.600000023842"/>
				</Property>
				<Property name="Rotation" type="App::PropertyAngle">
					<Float value="0.000000000000"/>
				</Property>
				<Property name="RotationAxis" type="App::PropertyEnumeration">
					<Integer value="2"/>
				</Property>
				<Property name="TextColor" type="App::PropertyColor">
					<PropertyColor value="4294901760"/>
				</Property>
				<Property name="Visibility" type="App::PropertyBool">
					<Bool value="true"/>
				</Property>
			</Properties>
		</ViewProvider>
  • Document.xml: contains all information relating to the constituent objects your project.
    • Example with Text004
<Object type="App::Annotation" name="Text004" />
<Object name="Text004">
			<Properties Count="3">
				<Property name="Label" type="App::PropertyString">
					<String value="Text004"/>
				</Property>
				<Property name="LabelText" type="App::PropertyStringList">
					<StringList count="1">
						<String value="135"/>
					</StringList>
				</Property>
				<Property name="Position" type="App::PropertyVector">
					<PropertyVector valueX="-30.000000000000" valueY="26.000000000000" valueZ="0.000000000000"/>
				</Property>
			</Properties>
		</Object>
  • Information such as :
<VectorList file="Points1"/> 
<ColorList file="DiffuseColor"/> 
<Mesh file="MeshKernel.bms"/> 
<Part file="PartShape.brp2"/>
. . . .
  • as well as other definitions containers file= relate has a file and if you change example "DiffuseColor" in <ColorList file="DiffuseColor"/> You must also change the name of the file for correspondence.
  • Once the Word change is identified, search (your Word) and Replace by (your new word) and click on Replace in all open documents and your change will be the same in both files GuiDocument.xml and Document.xml.
  • When changes are complete, return to the Menu Tools → Project utility... Create project
  • Source: Give the path of the file that you just changed and that is to restore.
  • Destination: Give the path of the FCStd file to restore.
  • Click ... In the new window click on Create a new folder (to avoid errors by rewriting the file) and you post. Click on Create you can check the "Load project file after creation".
  • If you have checked "Load project file after creation" your project will load in FreeCAD.
  • Note: It is imperative that it have concordance GuiDocument.xml, Document.xml documents and files without which there will be errors in your .FCStd file. To do this should always work on a copy of your project.

Other