File Format FCStd/it: Difference between revisions

From FreeCAD Documentation
No edit summary
(Updating to match new version of source page)
 
(82 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
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.
{{TOCright}}

<span id="Overview"></span>
==Introduzione==

Il '''Formato nativo dei file di FreeCAD''' (FreeCAD Standard file format) {{FileName|.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.

<span id="Internals_of_.FCStd_files"></span>
== Contenuto di un file .FCStd ==

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


===Document.xml===
Fare un '''copia''' del progetto e attenersi alla seguente procedura :


Questo è il file {{FileName|.xml}} principale che descrive tutti gli oggetti contenuti in un documento di FreeCAD.
FCStd is a standard zip file, containing [[#Contents |one or more]] files in a specific [[#structure |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.
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 {{FileName|Document.xml}}.


<span id="Example_Document.xml"></span>
===Contents===
====Document.xml====
==== Esempio di 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 xml document will be used.=


{{Code|lang=xml|code=
===== Example Document.xml=====
<syntaxhighlight>
<?xml version='1.0' encoding='utf-8'?>
<?xml version='1.0' encoding='utf-8'?>
<!--
<!--
Line 102: Line 113:
</ObjectData>
</ObjectData>
</Document>
</Document>
}}
</syntaxhighlight>
Creare una nuova directory e posizionare la copia in quella directory. Il file .FCStd può contenere molti file.


====Thumbnails/thumbnail.png====
===GuiDocument.xml===


Questa è la controparte GUI del file {{FileName|Document.xml}}.
Si tratta di un'immagine di anteprima di 128x128 pixel del documento, che è uno screenshot della vista 3D in fase di salvataggio.
Per ogni oggetto descritto nel {{FileName|Document.xml}}, c'è un corrispondente oggetto in {{FileName|GuiDocument.xml}} il quale descrive la rappresentazione visiva di quell'oggetto (colore, larghezza di linea, ecc.)


===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.
Le miniature vengono generate solo quando, nelle preferenze di FreeCAD, è attivata la corrispondente opzione.


====Templates/*.svg====
===*.brep===
In the Templates folder are stored the template svg files used in [[Drawing Module|Drawing]] pages.


Queste sono le forme [[wikipedia:Boundary representation|B-rep]] di tutti gli oggetti che hanno una forma Parte in {{FileName|Document.xml}}.
* Così come le altre definizioni anche quelle contenenti '''file=''' sono collegate a un file e quando, ad esempio, si modifica '''DiffuseColor''' in '''<ColorList file="DiffuseColor"/>''' è necessario modificare anche il nome del file corrispondente.
Ogni oggetto, anche se è parametrico, ha la sua forma memorizzata in un file {{FileName|.brep}} individuale, in modo che si può accedere ai suoi componenti senza la necessità di ricalcolarne la forma.
* Individuare il termine da modificare, eseguire '''Ricerca''' (il termine da modificare) poi '''Sostituire con '''(il nuovo termine) e infine cliccare su {{KEY|Sostituire in tutti i documenti aperti}}. La modifica viene apportata in entrambi i file, sia in '''GuiDocument.xml''' che in '''Document.xml'''.
* Dopo aver completato le modifiche, tornare a '''Menu > Strumenti > Utilità di Progetto... Crea progetto'''
* Fonte : Fornire il percorso per il file modificato, e che è quello da ripristinare.
* Destinazione : Fornire il percorso per il file FCStd da ripristinare.
* Fare clic su {{KEY|...}} e nella nuova finestra fare clic su {{KEY|Crea una nuova cartella}} per evitare di sovrascrivere i file. Cliccare su {{KEY|Crea}} e eventualmente attivare "Carica il file di progetto dopo la creazione".
* Se la casella "Carica il file di progetto dopo la creazione " è selezionata, il progetto viene automaticamente caricato in FreeCAD.
* '''PS:''' è imperativo che ci sia concordanza tra i documenti GuiDocument.xml, Document.xml e i file altrimenti il file .FCStd contiene degli errori. Per questo motivo si deve sempre lavorare su una copia del progetto.


===Structure===
===*.svg===
Structure of a typical FCStd file:
<syntaxhighlight>
--File.fcstd
|
--Document.xml
--GuiDocument.xml
|
--Thumbnails
|
--thumbnail.png
|
--Templates
|
--MyPage.svg
--Shape1.brep
--Shape2.brep
--etc...
</syntaxhighlight>
===Modificare il file .FCStd===


Questi sono i file svg modello utilizzati nelle pagine di [[TechDraw_Workbench/it|TechDraw]].
{{VeryImportantMessage|'''ATTENZIONE LAVORARE SEMPRE SU UNA COPIA DEL PROGETTO !'''}}


<span id="Typical_structure"></span>
È possibile modificare un file originale .FCStd, ma la procedura non è senza rischi, perciò si deve sempre lavorare su una '''copia'''.
===Struttura tipica===


Struttura di un tipico file {{FileName|.FCStd}}. L'estensione può essere modificata in {{FileName|.zip}} per esplorarla come una normale directory. {{FileName|Document.xml}} e {{FileName|GuiDocument.xml}} si trovano nella radice dell'archivio, insieme a tutti i file {{FileName|.brp}} (BREP). Una sottodirectory può contenere la miniatura e un'altra i modelli SVG utilizzati da [[TechDraw_Workbench/it|TechDraw]].
After having made an '''copy''' of your project, follow these steps :


<!--DO NOT remove the <pre> </pre> tags. These are used to display the text exactly like this.-->
Create a new directory and place your copy in that directory (there may be many files in your FCStd).
<pre>
File.FCStd (File.zip)
|
|--thumbnails/
| |
| :--Thumbnail.png
|
:--Document.xml
:--GuiDocument.xml
:--Shape1.brp
:--Shape2.brp
:--MyPage.svg
:--etc.
</pre>


<span id="Embedding_other_files"></span>
* Go in '''Menu > tools > Project utility... Project utility'''
== Incorporare altri file ==
[[File:Project utility en.png|240px]]
* Source : Give your copy to unpack path.
* Destination : Give the path to the unzipped files.
* Click {{KEY|Extract}}
* Go to your directory and open both files '''GuiDocument.xml''' andt '''Document.xml''' using [http://notepad-plus-plus.org/ Notepad++] (Windows) (Notepad++ to modify a word in all open documents).
*'''GuiDocument.xml''' : contains all your project information to the interface, display in the Combo view, the configuration of FreeCAD . . .
**Example with '''Text004'''
<syntaxhighlight>
<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>
</syntaxhighlight>


Per incorporare altri tipi di file all'interno di un file FCStd, bisogna prima creare un [[Scripted_objects/it|oggetto da script]] dalla [[Python_console/it|console Python]] e assegnargli una proprietà {{incode|App::PropertyFileIncluded}}.
*'''Document.xml''' : contains all information relating to the constituent objects your project.
**Example with '''Text004'''
<syntaxhighlight>
<Object type="App::Annotation" name="Text004" />
</syntaxhighlight>


Quindi nell'[[Property_editor/it|editor delle proprietà]] si può andare alla proprietà aggiunta e scegliere un file nel computer. Una volta salvato il file FCStd, il file assegnato alla proprietà {{PropertyData|PropertyFileIncluded}} verrà compresso all'interno di {{incode|.FCStd}}. Quando il documento viene ripristinato, lo stesso file verrà ripristinato con la proprietà {{PropertyData|PropertyFileIncluded}}.


{{Code|code=
<syntaxhighlight>
custom_obj = App.ActiveDocument.addObject("App::FeaturePython", "CustomObject")
<Object name="Text004">
custom_obj.addProperty("App::PropertyFileIncluded", "AttachedFile")
<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>


Vedere nel forum la discussione [https://forum.freecadweb.org/viewtopic.php?t=38201 PDF inside the project].
</syntaxhighlight>
* Le informazioni come :
<syntaxhighlight>
<VectorList file="Points1"/>
<ColorList file="DiffuseColor"/>
<Mesh file="MeshKernel.bms"/>
<Part file="PartShape.brp2"/>
. . . .
</syntaxhighlight>


<span id="Change_the_source_of_the_file_.FCStd"></span>
* 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.
==Modificare il codice sorgente del file .FCStd==
* 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 '''GuiDocument.xml''' and '''Document.xml'''.
* When changes are complete, return to the tool '''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 {{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.
* '''PS :''' 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.


* Vedere [[Std_ProjectUtil/it|Utilità di progetto]].
==Altri link==


Un utile programma convertitore: [[ImageConv/it|ImageConv]].


{{Userdocnavi{{#translation:}}}}
[[Category:User Documentation/it]]
[[Category:Developer{{#translation:}}]]
[[Category:Developer Documentation{{#translation:}}]]
[[Category:File_Formats{{#translation:}}]]
{{clear}}
{{clear}}
<languages/>

Latest revision as of 14:15, 30 April 2024

Introduzione

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 struttura specifica. 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.

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.

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 linea, ecc.)

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.

*.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.

*.svg

Questi sono i file svg modello utilizzati nelle pagine di TechDraw.

Struttura tipica

Struttura di un tipico file .FCStd. L'estensione può essere modificata in .zip per esplorarla come una normale directory. Document.xml e GuiDocument.xml si trovano nella radice dell'archivio, insieme a tutti i file .brp (BREP). Una sottodirectory può contenere la miniatura e un'altra i modelli SVG utilizzati da TechDraw.

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

Incorporare altri file

Per incorporare altri tipi di file all'interno di un file FCStd, bisogna prima creare un oggetto da script dalla console Python e assegnargli una proprietà App::PropertyFileIncluded.

Quindi nell'editor delle proprietà si può andare alla proprietà aggiunta e scegliere un file nel computer. Una volta salvato il file FCStd, il file assegnato alla proprietà DatiPropertyFileIncluded verrà compresso all'interno di .FCStd. Quando il documento viene ripristinato, lo stesso file verrà ripristinato con la proprietà DatiPropertyFileIncluded.

custom_obj = App.ActiveDocument.addObject("App::FeaturePython", "CustomObject")
custom_obj.addProperty("App::PropertyFileIncluded", "AttachedFile")

Vedere nel forum la discussione PDF inside the project.

Modificare il codice sorgente del file .FCStd