Formato dei file FCStd

From FreeCAD Documentation
Revision as of 08:25, 10 May 2020 by FuzzyBot (talk | contribs) (Updating to match new version of source page)

Il Formato nativo dei file di FreeCAD (FreeCAD Standard file format) .FCStd è il formato principale dei file di FreeCAD. Si tratta di un formato composto che supporta la compressione e l'incorporamento di diversi tipi di dati.

Contenuto di un file .FCStd

FCStd è un file zip standard contenente uno o più file in una determinata struttura. Come tale, è possibile decomprimere un file .FCStd utilizzando un normale strumento di decompressione zip, mentre invece si deve stare attenti a impacchettare il contenuto di un file .FCStd. FreeCAD contiene una "Project Utility" per 'ripacchettare' i file .FCStd, il suo uso è descritto nel paragrafo sootttostante Modificare il codice sorgente del file .FCStd.

Contenuto

Document.xml

Questo è il file .xml principale che descrive tutti gli oggetti contenuti in un documento di FreeCAD. Descrive solo la definizione geometrica e parametrica degli oggetti, ma non la loro rappresentazione visiva. Se FreeCAD viene eseguito in modalità console (senza GUI), viene utilizzato solo questo 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.

Esempio di 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

Questa è la controparte GUI del file Document.xml. Per ogni oggetto descritto nel Document.xml, c'è un corrispondente oggetto in GuiDocument.xml il quale descrive la rappresentazione visiva di quell'oggetto (colore, larghezza di riga, ecc.)

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

Si tratta di un'immagine di anteprima di 128x128 pixel del documento, che è uno screenshot della vista 3D in fase di salvataggio.

Le miniature vengono generate solo quando, nelle preferenze di FreeCAD, è attivata la corrispondente opzione.

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

Nella cartella Templates vengono memorizzati i file dei modelli svg utilizzati nelle pagine di Disegno.

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

*.brep

Queste sono le forme B-rep di tutti gli oggetti che hanno una forma Parte in Document.xml. Ogni oggetto, anche se è parametrico, ha la sua forma memorizzata in un file .brep individuale, in modo che si può accedere ai suoi componenti senza la necessità di ricalcolarne la forma.

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.

Struttura

Struttura di un tipico file FCStd:

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.

Modificare il codice sorgente del file .FCStd

ATTENZIONE LAVORARE SEMPRE SU UNA COPIA DEL PROGETTO !

È possibile modificare un file originale FCStd, ma la procedura non è senza rischi, perciò si deve sempre lavorare su una copia.

Altri link

Un utile programma convertitore: ImageConv.